Remove a PowerShell DSC Configuration Remove a PowerShell DSC Configuration powershell powershell

Remove a PowerShell DSC Configuration


To move the 7zip installation out of scope, you can apply another configuration that does not specify 7zip. The configurations do not "roll back" so, it if was installed, it'll stay installed. If it is removed later, it will not be re-installed.

You can also go the manual route and delete the configuration document from c:\windows\system32\configuration. You'd need to remove Current.mof, backup.mof, and possibly Previous.mof.


Remove-DscConfigurationDocument will do the trickhttps://technet.microsoft.com/en-us/library/mt143544.aspx

The Remove-DscConfigurationDocument cmdlet removes a configuration document (.mof file) from the DSC configuration store. During configuration, the Start-DscConfiguration cmdlet copies a .mof file into to a folder on the target computer. This cmdlet removes that configuration document and does additional cleanup.


Steven is correct. When I run this:

Remove-Item C:\Windows\System32\Configuration\Current.mof, C:\Windows\System32\Configuration\backup.mof, C:\Windows\System32\Configuration\Previous.mof

Now Get-DscConfiguration returns the same error as a clean machine:

Get-DscConfiguration : Current configuration does not exist. Start a DSC configuration first to create a current configuration.

That is what I was looking for. I understand that it doesn't revert the configuration. I just wanted to "undo" the configuration being applied.

Thanks!