Open KenBenjamin opened 3 years ago
Some registry values require a reboot to take effect. Currently, there is no way to set $global:DSCMachineStatus = 1
$global:DSCMachineStatus = 1
Add a parameter such as RequireReboot that sets $global:DSCMachineStatus = 1 in the Set-TargetResource function.
RequireReboot
Set-TargetResource
configuration "DisableRDPNLA" { Import-DscResource -ModuleName PSDscResources Registry "RegistryDisableRDPNLA" { Key = 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' ValueName = 'UserAuthentication' ValueData = 0 ValueType = 'Dword' Force = $true Ensure = 'Present' } }
OsName : Microsoft Windows Server 2019 Datacenter OsOperatingSystemSKU : DatacenterServerEdition OsArchitecture : 64-bit WindowsVersion : 1809 WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434 OsLanguage : en-US OsMuiLanguages : {en-US}
Name Value
PSVersion 5.1.17763.1971 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.17763.1971 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1
2.12.0.0
Details of the scenario you tried and the problem that is occurring
Some registry values require a reboot to take effect. Currently, there is no way to set
$global:DSCMachineStatus = 1
Verbose logs showing the problem
Suggested solution to the issue
Add a parameter such as
RequireReboot
that sets$global:DSCMachineStatus = 1
in theSet-TargetResource
function.The DSC configuration that is used to reproduce the issue (as detailed as possible)
The operating system the target node is running
OsName : Microsoft Windows Server 2019 Datacenter OsOperatingSystemSKU : DatacenterServerEdition OsArchitecture : 64-bit WindowsVersion : 1809 WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434 OsLanguage : en-US OsMuiLanguages : {en-US}
Version and build of PowerShell the target node is running
Name Value
PSVersion 5.1.17763.1971 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.17763.1971 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1
Version of the DSC module that was used ('dev' if using current dev branch)
2.12.0.0