Thursday 14 August 2008

Quick Access to OpsMgr Agent Information

Sometimes you need access to some information from Opsmgr in a hurry and you really do not want to open up the Ops Console and wait for it to load.

Here is a powershell script that extracts information from OpsMgr and drops it into several HTML files so it can be added to a website.
Download Script


The pages created are the following

AgentsCounts.html - This gives give you a count of the number of agents per management group and breaks this down also by per management server

MonitoredServers.html - This page gives a complete list of all the agents being monitored by Opsmgr.

ServersDown.html
- This gives a list of servers that may be down. It is actually a list of servers where the health service watcher is in an "Error" state.

AgentsLast7days.html
- This is a list of all agents installed in the last 7 days, when they were installed and includes their health state

The script does require some configuration before it can be used:

1) At the very start of the script you have to enter the name of the Root Management Server. You can uncomment the next lines lines and define multiple RMS's if you want to pull the information from more than 1 management group.

2) $outpath = "c:\" - Change this to where you want the script to write the html files.

3) If connecting to more than one management group you need to comment out line 17 and uncomment Line 19

2 comments:

Anonymous said...

PS C:\Documents and Settings\Administrator.CONTOSO\Desktop> .\MonitoredServers.ps1

PathName :
ManagementGroup : CONTOSO
ManagementServerName : OM2K7-SVR01
Drives :

The term 'Now' is not recognized as a cmdlet, function, operable program, or script file.
.
At C:\Documents and Settings\Administrator.CONTOSO\Desktop\MonitoredServers.ps1:21 char:1
+ $Now = Now <<<<
PS Microsoft.EnterpriseManagement.OperationsManager.Client\OperationsManagerMonitoring::>

When I execute the script it gives me this error.

I just changed it $Now =[DateTime]::Now

and it all works fine.. thanks for this useful script and keep up the good work!

Derek Harkin said...

Hmm, I never have a problem using just "Now" when I run it in my environment.
I have made the change suggested though in case others have this issue.