I often hear from customers, that they need a solution to delete expired Client Operations, the console Looks like this, but with more than hundreds of Operations:
The GUI won’t allow you to delete multiple Operation Status at the same time:
Would you like to delete all of this entries manually? Even if I could charge the hours as a Consultant, no way…
Just take a look to this powershell line, which deletes all expired operations:
Foreach($cmcops in Get-CMClientOperations){If ($cmcops.IsExpired -eq 1) {Remove-CMClientOperation -Id $cmcops.ID -Force}}
An easy one-liner, don’t you think?
Hope this helps 🙂
Martin
Anything I need to install first… I get an error when running it
Get-CMClientOperations : The term ‘Get-CMClientOperations’ is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct a
nd try again.
At line:1 char:20
No, not installed. You should only have imported the SCCM Module:
http://cm12sdk.net/?page_id=1623
[…] I have been using the wonderful script from the site https://blog.hosebei.ch/2014/01/14/sccm-2012-r2-delete-client-operations-status/ […]