Creating Module
This commit is contained in:
37
Private/Copy-ConfigurationDataValue.ps1
Normal file
37
Private/Copy-ConfigurationDataValue.ps1
Normal file
@@ -0,0 +1,37 @@
|
||||
function Copy-ConfigurationDataValue {
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[AllowNull()]
|
||||
$Value
|
||||
)
|
||||
|
||||
if($null -eq $Value){
|
||||
return $null
|
||||
}
|
||||
|
||||
if($Value -is [System.Collections.Specialized.OrderedDictionary]){
|
||||
$Copy = [ordered]@{}
|
||||
foreach($Entry in $Value.GetEnumerator()){
|
||||
$Copy[$Entry.Name] = Copy-ConfigurationDataValue -Value $Entry.Value
|
||||
}
|
||||
return $Copy
|
||||
}
|
||||
|
||||
if($Value -is [System.Collections.Hashtable]){
|
||||
$Copy = @{}
|
||||
foreach($Entry in $Value.GetEnumerator()){
|
||||
$Copy[$Entry.Name] = Copy-ConfigurationDataValue -Value $Entry.Value
|
||||
}
|
||||
return $Copy
|
||||
}
|
||||
|
||||
if($Value -is [System.Array]){
|
||||
$Copy = @()
|
||||
foreach($Item in $Value){
|
||||
$Copy += ,(Copy-ConfigurationDataValue -Value $Item)
|
||||
}
|
||||
return ,$Copy
|
||||
}
|
||||
|
||||
return $Value
|
||||
}
|
||||
Reference in New Issue
Block a user