Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

To remove the active Windows PowerShell Desired State Configuration (DSC) document, open an elevated PowerShell session and run:

Remove-DscConfigurationDocument -Stage Current -Verbose

This removes DSC’s stored current.mof document and performs DSC store cleanup. It does not uninstall DSC, guarantee that resource changes are reversed, or permanently prevent a pull server or management service from applying another configuration.

What “remove DSC” means

DSC removal can refer to several different operations. Choose the one that matches your goal:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Goal Command or action
Remove the active configuration document Remove-DscConfigurationDocument -Stage Current
Discard a configuration waiting to be applied Remove-DscConfigurationDocument -Stage Pending
Remove the prior configuration document Remove-DscConfigurationDocument -Stage Previous
Stop an operation currently running Stop-DscConfiguration
Change pull or auto-correction behavior Reconfigure the Local Configuration Manager (LCM)
Restore pre-DSC settings Perform an explicit rollback or remediation plan

Microsoft maps these stages to current.mof, pending.mof, and previous.mof in the DSC configuration store (LCM RemoveConfiguration reference).

Inspect the node before removal

Run PowerShell with Run as administrator. Capture the current state and LCM settings before making a destructive change:

Get-DscConfiguration | Out-File .dsc-configuration-before-removal.txt
Get-DscLocalConfigurationManager | Out-File .dsc-lcm-before-removal.txt
Get-DscConfigurationStatus | Out-File .dsc-status-before-removal.txt

Use the same commands interactively when you need to inspect the output:

Get-DscConfiguration
Get-DscLocalConfigurationManager
Get-DscConfigurationStatus

Get-DscConfiguration shows the configuration currently represented on the node. Get-DscLocalConfigurationManager shows whether the LCM is using push or pull behavior and its configuration mode. Status output can reveal a running or failed job. Microsoft’s DSC getting-started documentation documents these inspection commands.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Remove the current document locally

  1. Check for an active operation:

    Get-DscConfigurationStatus
  2. If a job is running, stop it only after assessing the risk:

    Stop-DscConfiguration -Force

    -Force can interrupt a resource operation and leave a partially completed change, so avoid using it reflexively on production servers.

  3. Preview the document-removal operation where supported:

    Remove-DscConfigurationDocument -Stage Current -WhatIf

    This confirms the selected operation; it is not a full impact analysis of every change previously made by DSC resources.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  4. Remove the active document:

    Remove-DscConfigurationDocument -Stage Current -Verbose
  5. Verify the result:

    Get-DscConfigurationStatus
    Get-DscLocalConfigurationManager

The Microsoft getting-started guide uses Remove-DscConfigurationDocument -Stage Current for clearing the current configuration (Microsoft documentation).

Remove pending or previous documents

Use Pending when an unapplied configuration should be discarded:

Remove-DscConfigurationDocument -Stage Pending -Verbose

Use Previous only when you have a specific troubleshooting or housekeeping reason to remove the prior document:

Remove-DscConfigurationDocument -Stage Previous -Verbose

Keeping the previous document can help with troubleshooting or rollback planning. Do not delete every stage as a routine cleanup step. The cmdlet reference lists Current, Pending, and Previous as valid stages (Microsoft cmdlet reference).

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Remove DSC from a remote machine

Use a CIM session when remoting and authentication are available:

$Session = New-CimSession -ComputerName "Server01"

Remove-DscConfigurationDocument `
    -Stage Current `
    -CimSession $Session `
    -Verbose

$Session | Remove-CimSession

For alternate credentials:

$Credential = Get-Credential
$Session = New-CimSession -ComputerName "Server01" -Credential $Credential

Remove-DscConfigurationDocument `
    -Stage Current `
    -CimSession $Session `
    -Verbose

$Session | Remove-CimSession

Remote removal requires working CIM/PowerShell remoting, suitable firewall rules, valid authentication, and administrator privileges. Test connectivity separately with Test-WSMan Server01. See Microsoft’s cmdlet documentation for the remote pattern.

Removing the document does not undo DSC changes

Important: Removing a DSC document is not a universal rollback.

The cmdlet removes DSC’s stored configuration document and related store state. It does not automatically reverse every action performed by resources. Depending on the resources used, the machine may still have installed features or applications, users and groups, registry values, files, services, firewall rules, scheduled tasks, IIS settings, certificates, ACLs, environment variables, or networking changes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If the goal is a pre-DSC state:

  1. Record the current state and preserve relevant logs.
  2. Identify which DSC resources changed the machine.
  3. Create an explicit undo configuration or documented manual rollback.
  4. Apply and validate that remediation.
  5. Remove the DSC document only when the node should no longer retain that configuration.

The LCM exposes separate operations for applying, testing, stopping, rolling back, removing documents, and changing meta-configuration; document removal should therefore not be described as an inverse operation (LCM class reference).

When DSC keeps coming back

A node configured for pull mode or automatic correction can receive or reapply a configuration after its local document is removed. Inspect:

Get-DscLocalConfigurationManager

Pay attention to RefreshMode, ConfigurationMode, ConfigurationModeFrequencyMins, RefreshFrequencyMins, ConfigurationID, and any pull-server or Azure State Configuration settings.

If the node must remain enrolled, change the LCM meta-configuration through your organization’s supported procedure rather than deleting files manually. The exact steps depend on Windows PowerShell DSC versus another DSC implementation, push versus pull mode, and whether Azure Automation or another control plane manages the node. Removing current.mof alone does not guarantee that future enforcement stops.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting

“A configuration is running” or confirmation is requested

Inspect status first:

Get-DscConfigurationStatus

If interruption is approved, stop the operation and retry:

Stop-DscConfiguration -Force
Remove-DscConfigurationDocument -Stage Current -Verbose

Alternatively, -Force on the removal cmdlet stops a running configuration and suppresses confirmation:

Remove-DscConfigurationDocument -Stage Current -Force -Verbose

Permission or missing-cmdlet errors

Confirm elevation and availability of the cmdlet:

Get-Command Remove-DscConfigurationDocument

The cited reference covers the Windows PowerShell PSDesiredStateConfiguration implementation (module version 1.1). Availability and behavior should be checked against the installed Windows version, PowerShell edition, and DSC implementation.

Remote failures

Test the target independently:

Test-WSMan Server01

Then verify credentials, firewall policy, CIM connectivity, and privileges. A successful local command does not prove that remote management is configured.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Diagnostics

Review recent DSC operational events:

Get-WinEvent -LogName "Microsoft-Windows-Dsc/Operational" -MaxEvents 50

If the document is removed successfully but configuration returns, investigate pull-server polling, consistency checks, scheduled management agents, and organizational policy.

Should you delete the MOF file manually?

Usually no. Use Remove-DscConfigurationDocument, because Microsoft documents it as removing the selected document and performing additional cleanup. Manually deleting files, the entire DSC directory, or DSC services can leave LCM state inconsistent.

Reserve manual file recovery for a documented incident procedure after capturing diagnostics, confirming no configuration is running, taking an appropriate backup or snapshot, and understanding the LCM consequences.

The Bottom Line

Bottom line: For a local Windows PowerShell DSC node, remove the active document with Remove-DscConfigurationDocument -Stage Current -Verbose. Inspect the LCM first, stop running jobs deliberately, use CIM for remote nodes, and plan a separate rollback if you need to undo changes DSC already made.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.