File tree 7 files changed +52
-15
lines changed
DSC_IEEnhancedSecurityConfiguration
7 files changed +52
-15
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
30
30
- Updated unit tests to use Should -Invoke for Pester 5 compatibility.
31
31
- ` VirtualMemory ` fix incorrect variable name
32
32
- ` SmbServerConfiguration ` remove errant argument
33
+ - Update all calls to edit the registry so that the value Type is explicitly set.
34
+ Fixes [ Issue #433 ] ( https://github.com/dsccommunity/ComputerManagementDsc/issues/433 ) .
33
35
34
36
### Changed
35
37
Original file line number Diff line number Diff line change @@ -134,6 +134,7 @@ function Set-TargetResource
134
134
Path = $registryKey
135
135
Name = $script :registryKey_Property
136
136
Value = $Enabled
137
+ Type = ' DWord'
137
138
ErrorAction = ' Stop'
138
139
}
139
140
Original file line number Diff line number Diff line change @@ -171,12 +171,28 @@ function Set-TargetResource
171
171
if ($Ensure -ne $targetResource.Ensure )
172
172
{
173
173
Write-Verbose - Message ($script :localizedData.SettingRemoteDesktopAdminMessage -f $Ensure )
174
- Set-ItemProperty - Path $script :tSRegistryKey - Name " fDenyTSConnections" - Value $fDenyTSConnectionsRegistry
174
+
175
+ $setItemPropertyParameters = @ {
176
+ Path = $script :tSRegistryKey
177
+ Name = " fDenyTSConnections"
178
+ Value = $fDenyTSConnectionsRegistry
179
+ Type = ' DWord'
180
+ }
181
+
182
+ Set-ItemProperty @setItemPropertyParameters
175
183
}
176
184
177
185
if ($UserAuthentication -ne $targetResource.UserAuthentication )
178
186
{
179
187
Write-Verbose - Message ($script :localizedData.SettingUserAuthenticationMessage -f $UserAuthentication )
180
- Set-ItemProperty - Path $script :winStationsRegistryKey - Name " UserAuthentication" - Value $UserAuthenticationRegistry
188
+
189
+ $setItemPropertyParameters = @ {
190
+ Path = $script :winStationsRegistryKey
191
+ Name = " UserAuthentication"
192
+ Value = $UserAuthenticationRegistry
193
+ Type = ' DWord'
194
+ }
195
+
196
+ Set-ItemProperty @setItemPropertyParameters
181
197
}
182
198
}
Original file line number Diff line number Diff line change @@ -899,8 +899,15 @@ function Set-WindowsEventLogRestrictGuestAccess
899
899
900
900
try
901
901
{
902
- Set-ItemProperty - Path $logRegistryPath `
903
- - Name ' RestrictGuestAccess' - Value $RestrictGuestAccess - ErrorAction Stop
902
+ $setItemPropertyParameters = @ {
903
+ Path = $logRegistryPath
904
+ Name = ' RestrictGuestAccess'
905
+ Value = $RestrictGuestAccess
906
+ Type = ' DWord'
907
+ ErrorAction = ' Stop'
908
+ }
909
+
910
+ Set-ItemProperty @setItemPropertyParameters
904
911
}
905
912
catch
906
913
{
Original file line number Diff line number Diff line change @@ -59,10 +59,14 @@ AfterAll {
59
59
60
60
if ($script :currentPendingFileRenameState )
61
61
{
62
- $null = Set-ItemProperty `
63
- - Path $script :rebootRegistryKeys.PendingFileRename `
64
- - Name PendingFileRenameOperations `
65
- - Value $script :currentPendingFileRenameState
62
+ $setItemPropertyParameters = @ {
63
+ Path = $script :rebootRegistryKeys.PendingFileRename
64
+ Name = ' PendingFileRenameOperations'
65
+ Value = $script :currentPendingFileRenameState
66
+ Type = ' MultiString'
67
+ }
68
+
69
+ $null = Set-ItemProperty @setItemPropertyParameters
66
70
}
67
71
}
68
72
Original file line number Diff line number Diff line change @@ -384,7 +384,8 @@ Describe 'DSC_RemoteDesktopAdmin\Set-TargetResource' -Tag 'Set' {
384
384
385
385
Should - Invoke - CommandName Set-ItemProperty - ParameterFilter {
386
386
$Name -eq ' fDenyTSConnections' -and
387
- $Value -eq ' 0'
387
+ $Value -eq ' 0' -and
388
+ $Type -eq ' DWord'
388
389
} - Times 1 - Exactly - Scope It
389
390
}
390
391
}
@@ -408,7 +409,8 @@ Describe 'DSC_RemoteDesktopAdmin\Set-TargetResource' -Tag 'Set' {
408
409
409
410
Should - Invoke - CommandName Set-ItemProperty - ParameterFilter {
410
411
$Name -eq ' fDenyTSConnections' -and
411
- $Value -eq ' 1'
412
+ $Value -eq ' 1' -and
413
+ $Type -eq ' DWord'
412
414
} - Times 1 - Exactly - Scope It
413
415
}
414
416
}
@@ -433,7 +435,8 @@ Describe 'DSC_RemoteDesktopAdmin\Set-TargetResource' -Tag 'Set' {
433
435
434
436
Should - Invoke - CommandName Set-ItemProperty - ParameterFilter {
435
437
$Name -eq ' UserAuthentication' -and
436
- $Value -eq ' 1'
438
+ $Value -eq ' 1' -and
439
+ $Type -eq ' DWord'
437
440
} - Times 1 - Exactly - Scope It
438
441
}
439
442
}
@@ -458,7 +461,8 @@ Describe 'DSC_RemoteDesktopAdmin\Set-TargetResource' -Tag 'Set' {
458
461
459
462
Should - Invoke - CommandName Set-ItemProperty - ParameterFilter {
460
463
$Name -eq ' UserAuthentication' -and
461
- $Value -eq ' 0'
464
+ $Value -eq ' 0' -and
465
+ $Type -eq ' DWord'
462
466
} - Times 1 - Exactly - Scope It
463
467
}
464
468
}
Original file line number Diff line number Diff line change @@ -467,17 +467,20 @@ Describe 'UserAccountControl\Set-UserAccountControlToNotificationLevel' -Tag 'Pr
467
467
468
468
Should - Invoke - CommandName Set-ItemProperty - ParameterFilter {
469
469
$Name -eq ' ConsentPromptBehaviorAdmin' -and
470
- $Value -eq $ConsentPromptBehaviorAdmin
470
+ $Value -eq $ConsentPromptBehaviorAdmin -and
471
+ $Type -eq ' DWord'
471
472
} - Exactly - Times 1 - Scope It
472
473
473
474
Should - Invoke - CommandName Set-ItemProperty - ParameterFilter {
474
475
$Name -eq ' EnableLUA' -and
475
- $Value -eq $EnableLua
476
+ $Value -eq $EnableLua -and
477
+ $Type -eq ' DWord'
476
478
} - Exactly - Times 1 - Scope It
477
479
478
480
Should - Invoke - CommandName Set-ItemProperty - ParameterFilter {
479
481
$Name -eq ' PromptOnSecureDesktop' -and
480
- $Value -eq $PromptOnSecureDesktop
482
+ $Value -eq $PromptOnSecureDesktop -and
483
+ $Type -eq ' DWord'
481
484
} - Exactly - Times 1 - Scope It
482
485
}
483
486
You can’t perform that action at this time.
0 commit comments