I’m working with Windows Desired State Configuration (DSC) using Ansible’s win_dsc
module. However, I encountered an issue where a DSC operation initiated by Ansible hangs indefinitely, causing the Ansible provisioning process to halt without progress.
When I try to forcefully stop the ongoing DSC operation using PowerShell, I get an error message indicating that the Invoke-DscResource
cmdlet is still in progress and must return before I can invoke the Stop-DscConfiguration -Force
cmdlet:
PS C:Windowssystem32> Stop-DscConfiguration -Force
Stop-DscConfiguration : Cannot invoke the Stop-DscConfiguration -Force cmdlet. The Invoke-DscResource cmdlet is in
progress and must return before Stop-DscConfiguration -Force can be invoked. Use -Force option if that is available to
cancel the current operation.
At line:1 char:1
+ Stop-DscConfiguration -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (MSFT_DSCLocalConfigurationManager:root/Microsoft/...gurationManager) [Sto
p-DscConfiguration], CimException
+ FullyQualifiedErrorId : MI RESULT 1,Stop-DscConfiguration
The current DSC operation seems to be stuck and unresponsive to the -Force
option. The only solution I’ve found so far is to reboot the system, which obviously disrupts the workflow and isn’t feasible for production environments.
Is there a way to stop, cancel, or kill a running Windows DSC operation without rebooting the system?
I appreciate any guidance or suggestions on how to resolve this issue effectively, potentially without requiring a system reboot.