File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -153,11 +153,24 @@ Function Install-DSC {
153153 powershell.exe certutil - addstore -f root $ (" C:\DevOps" , $d.mR , " Certificates\PullServer.crt" -join ' \' )
154154 $i = 0
155155 do {
156- if ( $ ((Get-WinEvent Microsoft- Windows- DSC/ Operational | Select - First 1 ).id) -eq " 4104" ) {
156+ $StartConsistency = $false
157+ $Pending = Test-Path " C:\Windows\System32\Configuration\Pending.mof"
158+ $ConsistencyRunning = (Get-ScheduledTask - TaskName Consistency).State -eq " Running"
159+ if ( $ ((Get-WinEvent Microsoft- Windows- DSC/ Operational | Select - First 1 ).id) -eq " 4104" -or
160+ ($Pending -and (-not $ConsistencyRunning ))) {
157161 Get-ScheduledTask - TaskName " Consistency" | Start-ScheduledTask
162+ if ($Pending -and (-not $ConsistencyRunning ))
163+ {
164+ $StartConsistency = $true
165+ }
158166 }
159- if ($i -gt 5 ) {
160- Write-EventLog - LogName DevOps - Source BasePrep - EntryType Information - EventId 1000 - Message " Waiting for Client to install DSC configuration"
167+ if ($i -gt 5 -or $StartConsistency ) {
168+ $Message = " Waiting for Client to install DSC configuration"
169+ if ($StartConsistency )
170+ {
171+ $Message += " `n Found Pending.mof and Consistency task not running and therefore started Consistency Task"
172+ }
173+ Write-EventLog - LogName DevOps - Source BasePrep - EntryType Information - EventId 1000 - Message $Message
161174 $i = 0
162175 }
163176 $i ++
You can’t perform that action at this time.
0 commit comments