PowerShell to cleanup expired “Client Operations” tasks

Deleting old, unused Client Operations tasks in the Configuration Manager 2012 Console is a pain because you cannot delete multiple items; you have to delete one by one….

The following PowerShell Command will cleanup all expired “Client Operations” Tasks (Adminconsole node Monitoring\Client Operations).
Replace xxx with your SiteCode and run the command on the site server.

Get-WmiObject -namespace “root\sms\site_xxx” SMS_ClientOperationStatus -Filter IsExpired=1 | % { ([wmiclass]“root\sms\site_xxx:sms_ClientOperation”).DeleteClientOperation($_.ID )  }

email

Written by , Posted .