File tree Expand file tree Collapse file tree 7 files changed +52
-15
lines changed
DSC_IEEnhancedSecurityConfiguration Expand file tree Collapse file tree 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
3030 - Updated unit tests to use Should -Invoke for Pester 5 compatibility.
3131- ` VirtualMemory ` fix incorrect variable name
3232- ` 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 ) .
3335
3436### Changed
3537
Original file line number Diff line number Diff line change @@ -134,6 +134,7 @@ function Set-TargetResource
134134 Path = $registryKey
135135 Name = $script :registryKey_Property
136136 Value = $Enabled
137+ Type = ' DWord'
137138 ErrorAction = ' Stop'
138139 }
139140
Original file line number Diff line number Diff line change @@ -171,12 +171,28 @@ function Set-TargetResource
171171 if ($Ensure -ne $targetResource.Ensure )
172172 {
173173 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
175183 }
176184
177185 if ($UserAuthentication -ne $targetResource.UserAuthentication )
178186 {
179187 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
181197 }
182198}
Original file line number Diff line number Diff line change @@ -899,8 +899,15 @@ function Set-WindowsEventLogRestrictGuestAccess
899899
900900 try
901901 {
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
904911 }
905912 catch
906913 {
Original file line number Diff line number Diff line change @@ -59,10 +59,14 @@ AfterAll {
5959
6060 if ($script :currentPendingFileRenameState )
6161 {
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
6670 }
6771}
6872
Original file line number Diff line number Diff line change @@ -384,7 +384,8 @@ Describe 'DSC_RemoteDesktopAdmin\Set-TargetResource' -Tag 'Set' {
384384
385385 Should - Invoke - CommandName Set-ItemProperty - ParameterFilter {
386386 $Name -eq ' fDenyTSConnections' -and
387- $Value -eq ' 0'
387+ $Value -eq ' 0' -and
388+ $Type -eq ' DWord'
388389 } - Times 1 - Exactly - Scope It
389390 }
390391 }
@@ -408,7 +409,8 @@ Describe 'DSC_RemoteDesktopAdmin\Set-TargetResource' -Tag 'Set' {
408409
409410 Should - Invoke - CommandName Set-ItemProperty - ParameterFilter {
410411 $Name -eq ' fDenyTSConnections' -and
411- $Value -eq ' 1'
412+ $Value -eq ' 1' -and
413+ $Type -eq ' DWord'
412414 } - Times 1 - Exactly - Scope It
413415 }
414416 }
@@ -433,7 +435,8 @@ Describe 'DSC_RemoteDesktopAdmin\Set-TargetResource' -Tag 'Set' {
433435
434436 Should - Invoke - CommandName Set-ItemProperty - ParameterFilter {
435437 $Name -eq ' UserAuthentication' -and
436- $Value -eq ' 1'
438+ $Value -eq ' 1' -and
439+ $Type -eq ' DWord'
437440 } - Times 1 - Exactly - Scope It
438441 }
439442 }
@@ -458,7 +461,8 @@ Describe 'DSC_RemoteDesktopAdmin\Set-TargetResource' -Tag 'Set' {
458461
459462 Should - Invoke - CommandName Set-ItemProperty - ParameterFilter {
460463 $Name -eq ' UserAuthentication' -and
461- $Value -eq ' 0'
464+ $Value -eq ' 0' -and
465+ $Type -eq ' DWord'
462466 } - Times 1 - Exactly - Scope It
463467 }
464468 }
Original file line number Diff line number Diff line change @@ -467,17 +467,20 @@ Describe 'UserAccountControl\Set-UserAccountControlToNotificationLevel' -Tag 'Pr
467467
468468 Should - Invoke - CommandName Set-ItemProperty - ParameterFilter {
469469 $Name -eq ' ConsentPromptBehaviorAdmin' -and
470- $Value -eq $ConsentPromptBehaviorAdmin
470+ $Value -eq $ConsentPromptBehaviorAdmin -and
471+ $Type -eq ' DWord'
471472 } - Exactly - Times 1 - Scope It
472473
473474 Should - Invoke - CommandName Set-ItemProperty - ParameterFilter {
474475 $Name -eq ' EnableLUA' -and
475- $Value -eq $EnableLua
476+ $Value -eq $EnableLua -and
477+ $Type -eq ' DWord'
476478 } - Exactly - Times 1 - Scope It
477479
478480 Should - Invoke - CommandName Set-ItemProperty - ParameterFilter {
479481 $Name -eq ' PromptOnSecureDesktop' -and
480- $Value -eq $PromptOnSecureDesktop
482+ $Value -eq $PromptOnSecureDesktop -and
483+ $Type -eq ' DWord'
481484 } - Exactly - Times 1 - Scope It
482485 }
483486
You can’t perform that action at this time.
0 commit comments