From 49fe0b78152df82642df1bfa716fcfcfd649a888 Mon Sep 17 00:00:00 2001 From: Dreamcat4 Date: Sat, 19 Dec 2015 21:57:13 +0000 Subject: [PATCH] win_regedit: fixes #1404 When 'value:' is set to be the key's "(default)" property value --- lib/ansible/modules/extras/windows/win_regedit.ps1 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/extras/windows/win_regedit.ps1 b/lib/ansible/modules/extras/windows/win_regedit.ps1 index f9491e39c5..e3b8c9d3b1 100644 --- a/lib/ansible/modules/extras/windows/win_regedit.ps1 +++ b/lib/ansible/modules/extras/windows/win_regedit.ps1 @@ -57,8 +57,16 @@ if($state -eq "present") { { if (Test-RegistryValueData -Path $registryKey -Value $registryValue) { + if ($registryValue.ToLower() -eq "(default)") { + # Special case handling for the key's default property. Because .GetValueKind() doesn't work for the (default) key property + $oldRegistryDataType = "String" + } + else { + $oldRegistryDataType = (Get-Item $registryKey).GetValueKind($registryValue) + } + # Changes Data and DataType - if ((Get-Item $registryKey).GetValueKind($registryValue) -ne $registryDataType) + if ($registryDataType -ne $oldRegistryDataType) { Try {