Created
February 12, 2016 15:32
-
-
Save ploegert/312ebaf7275c1d96ff99 to your computer and use it in GitHub Desktop.
Flush any existing DSC Configuration #REf: https://techstronghold.com/blogs/scripting/how-to-remove-all-powershell-dsc-configuration-documents-mof-files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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