OpsMgr 2007 Powershell one-liner to get information on failed agent installations

Ever tried mass-installing a lot of agents from console? If yes, then you probably miss some feedback information. Once you close the running task window you loose the information. The information is kept, sadly enough in SUCCEEDED Task status – browsing through that to find failed installations in UI is hard (the failed info is kept in Task output not task status, so no easy filtering here). To get it by Powershell you can use something like:


get-taskresult | where {$_.Output -notlike “*<ErrorCode>0</ErrorCode>*” -and $_.Output -like “*MOM.MOMAgentManagementData*”} | ConvertTo-Html | set-content “D:\Scripts\GetTaskResult\FailedTasks.htm”


get-taskresult | where {$_.Output -notlike “*<ErrorCode>0</ErrorCode>*” -and $_.Output -like “*MOM.MOMAgentManagementData*”} | export-csv “D:\Scripts\GetTaskResult\FailedTasks.csv”

You can easily extend those to do some more elaborate filtering as the Output property is XML, and Psh can parse XML well.


Thx to Bogdan, my colleague from MS Poland, for giving me some background on where we keep the data. The rest was easy.


~ by alipka on March 4, 2008.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: