|
|
@ -42,6 +42,13 @@ If ($state -eq "present" -and $registryData -eq $null -and $registryValue -ne $n
|
|
|
|
Fail-Json $result "missing required argument: data"
|
|
|
|
Fail-Json $result "missing required argument: data"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# check the registry key is in powershell ps-drive format: HKLM, HKCU, HKU, HKCR, HCCC
|
|
|
|
|
|
|
|
If (-not ($registryKey -match "^H[KC][CLU][MURC]{0,1}:\\"))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Fail-Json $result "key: $registryKey is not a valid powershell path, see module documentation for examples."
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Function Test-RegistryValueData {
|
|
|
|
Function Test-RegistryValueData {
|
|
|
|
Param (
|
|
|
|
Param (
|
|
|
|
[parameter(Mandatory=$true)]
|
|
|
|
[parameter(Mandatory=$true)]
|
|
|
@ -58,8 +65,8 @@ Function Test-RegistryValueData {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Returns rue if registry data matches.
|
|
|
|
# Returns true if registry data matches.
|
|
|
|
# Handles binary and string registry data
|
|
|
|
# Handles binary, integer(dword) and string registry data
|
|
|
|
Function Compare-RegistryData {
|
|
|
|
Function Compare-RegistryData {
|
|
|
|
Param (
|
|
|
|
Param (
|
|
|
|
[parameter(Mandatory=$true)]
|
|
|
|
[parameter(Mandatory=$true)]
|
|
|
@ -67,15 +74,14 @@ Function Compare-RegistryData {
|
|
|
|
[parameter(Mandatory=$true)]
|
|
|
|
[parameter(Mandatory=$true)]
|
|
|
|
[AllowEmptyString()]$DifferenceData
|
|
|
|
[AllowEmptyString()]$DifferenceData
|
|
|
|
)
|
|
|
|
)
|
|
|
|
$refType = $ReferenceData.GetType().Name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($refType -eq "String" ) {
|
|
|
|
if ($ReferenceData -is [String] -or $ReferenceData -is [int]) {
|
|
|
|
if ($ReferenceData -eq $DifferenceData) {
|
|
|
|
if ($ReferenceData -eq $DifferenceData) {
|
|
|
|
return $true
|
|
|
|
return $true
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return $false
|
|
|
|
return $false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} elseif ($refType -eq "Object[]") {
|
|
|
|
} elseif ($ReferenceData -is [Object[]]) {
|
|
|
|
if (@(Compare-Object $ReferenceData $DifferenceData -SyncWindow 0).Length -eq 0) {
|
|
|
|
if (@(Compare-Object $ReferenceData $DifferenceData -SyncWindow 0).Length -eq 0) {
|
|
|
|
return $true
|
|
|
|
return $true
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -118,7 +124,7 @@ else
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if($registryDataType -eq "binary" -and $registryData -ne $null -and $registryData.GetType().Name -eq 'String') {
|
|
|
|
if($registryDataType -eq "binary" -and $registryData -ne $null -and $registryData -is [String]) {
|
|
|
|
$registryData = Convert-RegExportHexStringToByteArray($registryData)
|
|
|
|
$registryData = Convert-RegExportHexStringToByteArray($registryData)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|