You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Details of the scenario you tried and the problem that is occurring
The resource occasionally fails to set with the error "The process cannot access the file 'C:\windows\System32\GroupPolicy\Machine\registry.pol' because it is being used by another process."
This appears to be part of a race condition and I have encountered it several times, but on different registry policy values on each occurrence. I cannot reliably reproduce the problem.
I am using DSC as part of a "Microsoft Deployment Toolkit" (MDT) deployment, and have not found a good way to test which process is accessing registry.pol at the time of this error. Suggestions welcome!
Verbose logs showing the problem
[OBFUSCATED]: LCM: [ Start Resource ] [[RegistryPolicyFile]Win10Lockdown\CVE-2016-2183\Terminal Services - Security Layer]
[OBFUSCATED]: LCM: [ Start Test ] [[RegistryPolicyFile]Win10Lockdown\CVE-2016-2183\Terminal Services - Security Layer]
[OBFUSCATED]: [[RegistryPolicyFile]Win10Lockdown\CVE-2016-2183\Terminal Services - Security Layer] Retrieving current for Key SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services ValueName SecurityLayer. (RPF04)
[OBFUSCATED]: [[RegistryPolicyFile]Win10Lockdown\CVE-2016-2183\Terminal Services - Security Layer] Expected to find an array value for property ValueData in the current values, but it was either not present or was null. This has caused the test method to return false.
[OBFUSCATED]: [[RegistryPolicyFile]Win10Lockdown\CVE-2016-2183\Terminal Services - Security Layer] String value for property ValueType does not match. Current state is '' and desired state is 'Dword'.
[OBFUSCATED]: LCM: [ End Test ] [[RegistryPolicyFile]Win10Lockdown\CVE-2016-2183\Terminal Services - Security Layer] in 0.2510 seconds.
[OBFUSCATED]: LCM: [ Start Set ] [[RegistryPolicyFile]Win10Lockdown\CVE-2016-2183\Terminal Services - Security Layer]
[OBFUSCATED]: [[RegistryPolicyFile]Win10Lockdown\CVE-2016-2183\Terminal Services - Security Layer] Retrieving current for Key SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services ValueName SecurityLayer. (RPF04)
[OBFUSCATED]: [[RegistryPolicyFile]Win10Lockdown\CVE-2016-2183\Terminal Services - Security Layer] Adding policy with Key: SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services, ValueName: SecurityLayer, ValueData: System.String[], ValueType: Dword. (RPF001)
[OBFUSCATED]: LCM: [ End Set ] [[RegistryPolicyFile]Win10Lockdown\CVE-2016-2183\Terminal Services - Security Layer] in 1.1090 seconds.
PowerShell DSC resource MSFT_RegistryPolicyFile failed to execute Set-TargetResource functionality with error message: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: The process cannot access the file 'C:\windows\System32\GroupPolicy\Machine\registry.pol' because it is being used by another process.
InvalidOperation: (:) [], CimException
Suggested solution to the issue
The solution likely depends on which process is accessing the file. If it is the "Group Policy Client" service, perhaps RegistryPolicyFile should stop the service first, or at least check to see if the group policy is being updated.
Otherwise perhaps the RegistryPolicyFile could test access to the file, and wait for a short period if it is in use.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
Details of the scenario you tried and the problem that is occurring
The resource occasionally fails to set with the error "The process cannot access the file 'C:\windows\System32\GroupPolicy\Machine\registry.pol' because it is being used by another process."
This appears to be part of a race condition and I have encountered it several times, but on different registry policy values on each occurrence. I cannot reliably reproduce the problem.
I am using DSC as part of a "Microsoft Deployment Toolkit" (MDT) deployment, and have not found a good way to test which process is accessing registry.pol at the time of this error. Suggestions welcome!
Verbose logs showing the problem
Suggested solution to the issue
The solution likely depends on which process is accessing the file. If it is the "Group Policy Client" service, perhaps RegistryPolicyFile should stop the service first, or at least check to see if the group policy is being updated.
Otherwise perhaps the RegistryPolicyFile could test access to the file, and wait for a short period if it is in use.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
The operating system the target node is running
The operating system the target node is running
Version and build of PowerShell the target node is running
Version of the DSC module that was used
The text was updated successfully, but these errors were encountered: