Last active
January 14, 2019 23:30
-
-
Save techthoughts2/ba9c177405300cf6c344f42a53b6fa53 to your computer and use it in GitHub Desktop.
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
################################################################################ | |
# The "nice" way to reset the LCM... | |
if (-not(Test-Path -Path 'C:\Temp')) { $null = New-Item -Path 'C:\Temp' -ItemType 'Directory'} | |
[DscLocalConfigurationManager()] | |
Configuration ResetLCM { | |
Param ( | |
[String[]] | |
$NodeName | |
) | |
Node $NodeName { | |
Settings | |
{ | |
ActionAfterReboot = 'ContinueConfiguration' | |
AllowModuleOverwrite = $false | |
CertificateID = $null | |
ConfigurationDownloadManagers = @{} | |
ConfigurationID = $null | |
ConfigurationMode = 'ApplyAndMonitor' | |
ConfigurationModeFrequencyMins = 15 | |
DebugMode = @('NONE') | |
MaximumDownloadSizeMB = 500 | |
RebootNodeIfNeeded = $True | |
RefreshFrequencyMins = 30 | |
RefreshMode = 'PUSH' | |
ReportManagers = @{} | |
ResourceModuleManagers = @{} | |
SignatureValidations = @{} | |
StatusRetentionTimeInDays = 10 | |
} | |
} | |
} | |
$null = ResetLCM -NodeName 'localhost' -OutputPath 'C:\Temp\ResetLCM' | |
Set-DscLocalConfigurationManager -Path 'C:\Temp\ResetLCM' -ComputerName 'localhost' | |
Remove-DscConfigurationDocument -Stage Current, Pending, Previous -Verbose | |
################################################################################ | |
# If you REALLY want to force kill the LCM, do this! | |
Remove-Item C:\windows\system32\Configuration\*.mof* | |
Get-Process wmi* | Where-Object {?_.modules.ModuleName -like "*DSC*"} | Stop-Process -force | |
Remove-DscConfigurationDocument -Stage Current, Pending, Previous -Verbose | |
################################################################################ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment