|
|
@ -150,10 +150,12 @@ if ($type -eq "binary" -and $data -ne $null -and $data -is [String]) {
|
|
|
|
$data = Convert-RegExportHexStringToByteArray($data)
|
|
|
|
$data = Convert-RegExportHexStringToByteArray($data)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Expand string if type expandstring
|
|
|
|
# Special case handling for the path's default property.
|
|
|
|
if ($type -eq "expandstring" -and $data -ne $null -and $data -is [String]) {
|
|
|
|
if ($name.ToLower() -eq "(default)") {
|
|
|
|
$data = Expand-Environment($data)
|
|
|
|
if ($type -eq "expandstring" -and $data -ne $null -and $data -is [String]) {
|
|
|
|
$datatype = "string"
|
|
|
|
$data = Expand-Environment($data)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$type = "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($state -eq "present") {
|
|
|
|
if ($state -eq "present") {
|
|
|
@ -177,8 +179,12 @@ if ($state -eq "present") {
|
|
|
|
# Changes Data and DataType
|
|
|
|
# Changes Data and DataType
|
|
|
|
if (-not $check_mode) {
|
|
|
|
if (-not $check_mode) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Remove-ItemProperty -Path $path -Name $name
|
|
|
|
if ($name.ToLower() -eq "(default)") {
|
|
|
|
New-ItemProperty -Path $path -Name $name -Value $data -PropertyType $type -Force
|
|
|
|
$null = $(Get-Item -Path $path -ErrorAction 'Stop').OpenSubKey('','ReadWriteSubTree').SetValue($null,$data)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Remove-ItemProperty -Path $path -Name $name
|
|
|
|
|
|
|
|
New-ItemProperty -Path $path -Name $name -Value $data -PropertyType $type -Force
|
|
|
|
|
|
|
|
}
|
|
|
|
} catch {
|
|
|
|
} catch {
|
|
|
|
Fail-Json $result $_.Exception.Message
|
|
|
|
Fail-Json $result $_.Exception.Message
|
|
|
|
}
|
|
|
|
}
|
|
|
|