Skip to content

Instantly share code, notes, and snippets.

@ploegert
Created February 12, 2016 15:32
Show Gist options
  • Save ploegert/312ebaf7275c1d96ff99 to your computer and use it in GitHub Desktop.
Save ploegert/312ebaf7275c1d96ff99 to your computer and use it in GitHub Desktop.
#Reset DSC
function Flush-DSCConfig
{
#List current DSC Docs:
Get-ChildItem -Path 'C:\Windows\System32\Configuration' -File -Force
#Remove All Docs:
Remove-DscConfigurationDocument -Stage Current, Pending, Previous -Verbose
#Verify:
Get-ChildItem -Path 'C:\Windows\System32\Configuration' -File -Force
#Stop DSC Configuration
Stop-DscConfiguration -Verbose -Force
#Remove all mof files (pending,current,backup,MetaConfig.mof,caches,etc)
rm C:\windows\system32\Configuration\*.mof*
#Kill the LCM/DSC processes
gps wmi* | ? {$_.modules.ModuleName -like "*DSC*"} | stop-process -force
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment