-
Notifications
You must be signed in to change notification settings - Fork 1
/
ResetDSC.ps1
33 lines (24 loc) · 820 Bytes
/
ResetDSC.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#reset DSC
[cmdletbinding()]
Param(
[Parameter(Mandatory,Position=0)]
[string[]]$Computername
)
[DSCLocalConfigurationManager()]
configuration StandardLCM {
Param([string[]]$Computername)
Node $Computername {
Settings {
RebootNodeIfNeeded = $True
ConfigurationMode = 'ApplyAndMonitor'
AllowModuleOverwrite = $True
RefreshMode = 'Push'
}
} #node
} #config
StandardLCM -computername $computername -output c:\dsc\standard
Write-Host "Setting LCM back to default" -ForegroundColor Cyan
Set-DscLocalConfigurationManager -Path C:\dsc\standard -Verbose
Write-Host "Removing DSC documents" -ForegroundColor cyan
Remove-DscConfigurationDocument -Stage Pending -CimSession $Computername
Remove-DscConfigurationDocument -Stage Current -CimSession $Computername