Clear Software Center when a task is stuck at Downloading/Installing

$ccmProgram = Get-WmiObject -Namespace ROOT\CCM\ClientSDK
-Class CCM_Program | Where-Object {$_.EvaluationState –eq 14}

If ($ccmProgram -ne $null)

{

$ccmExecutionRequestEx = Get-WmiObject -Namespace ROOT\CCM\SoftMgmtAgent –Class
CCM_ExecutionRequestEx | Where-Object {$_.RunningState -eq
“NotifyExecution” -and $_.AdvertID -gt “” -and $_.ContentID
-eq $ccmProgram.PackageID}

If
($ccmExecutionRequestEx -ne $null)

{

$ccmExecutionRequestEx | Remove-WmiObject

Start-Process sc.exe -ArgumentList “config smstsmgr depend=
winmgmt/ccmexec” -Wait

Restart-Service -Name CcmExec -Force

}

}


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *