As there are many good ideas out there and so many bright minds, you just have to pull all this energy together mix it with your own ideas and you will create wonderful things.
A practical example would be the following story. A customer who likes simple things came up with an idea. Imagine you have a monthly maintenance window in your company where you are going to patch all your servers. As good practice you will put all your lovely servers into maintenance mode, great! After you applied your patches and you rebooted (?) your servers you probably want to check if all your servers rebooted, are up and running and healthy in SCOM.
Now the thing is, are you sure ALL your servers booted within your maintenance window? If you see a green agent in the SCOM console doesn’t guarantee you that the server rebooted. What if there are service desk guys who don’t know anything about SCOM and need a quick check to see if the server booted and is healthy, meaning available in SCOM.
Of course one approach could be creating rules which detect boot event id’s from each server and if the server does not generate such an event id it will throw an alert and so on, but honestly, don’t we have already enough alerts in SCOM ?
Inspired by the idea from the customer and by a blog post from this bright PowerShell guy Thiyagu here I wrote a PowerShell script which generates an HTML report. I adapted Thiyagu’s way of generating an HTML file in PowerShell, therefore all credits to him.
OK what is it all about…
1) First download the script from here
2) Run the Get-BootAvailabilityReport.ps1 providing 3 parameters
- uptimethreshold – This parameter defines how old is your maintenance window. Let’s say you finished patching and rebooting all your servers and every server is no longer up than 60 hours (in this example). If a server has an uptime more than 60 hours the server did not reboot.
- filename – Output path where you want to have the report file written e.g. c:\temp\report.html (must be a valid directory and a *.html file name)
- scom – SCOM management server which the script connects to.
3) After the script finished Internet Explorer opens and presents you a nice report
The report contains 6 columns:
- Server Name – This is the name of the server
- Last Boot Time – This is the time the server booted last
- Server Uptime – How long the server is up and running
- Server Uptime (Total Hours) – How long the server is up and running in hours
- Last Agent Health State – Last status of the agent health in SCOM
- Agent Available – Shows if the agent is available (=True) or e.g. grey (=False)
How to deal with it…
- The uptimethreshold parameter which you provide to the script is compared against the Server Uptime (Total Hours). If the Server Uptime (Total Hours) is greater than the uptimethreshold it will be colored red.
- If the Last Agent Health State has another result than Success it will be appear in red.
- If the Agent Available has another value than True it will be appear in red.
So that means if the last 3 column are colored green everything is ok. If Server Uptime (Total Hours) is red the server did not reboot. If Agent Available is colored red the SCOM agent is not available. The Last Agent Health State shows only the last health state the agent had in SCOM. This could be misleading, because if an agent is grey in SCOM and didn’t have a critical health state before it went grey this column will appear green.
I hope you get the idea behind and you like it as much I do.
The script uses the SCOM 2012 cmdlet’s and also WMI to query the servers. Make sure you have the necessary permissions and ports available for the script to run properly.
Download the script, have fun!
Hello Stefan,
Very good morning, I need your help in getting out the problem. The problem is i work on SCOM 2012 where i need to monitor SQL Azure and BLOB Storage in SCOM 2012 but as per the microsoft | scom 2012 won’t support sql, How ever there are some instance were we can change the settings and can do the installation of SQL Azure in SCOM 2012 [availability Monitoring] can you please help me in doing the configuration.
Thank you So much.
Regards,
ShivaJ
Hi there,
A very useful report to add to the toolbox, however it appears to be limited to a single domain. Is there any way we can execute the WMI query through SCOM/certificate credentials to agents in untrusted domains?
Hi I could not download the script. Please help asap.
Hi
I just tested the link and download works…
Cheers,
Stefan
Hi
Is there a way to run it against a group, we have different groups per customer.
Thanks
Hi Paul
What do you mean by “different groups”?
Cheers,
Stefan
Hi Stefan,
Thanks for this tool very useful report tool.
Can it be ran to specific Servers, or like a SCOM group?
Thanks
Hi
For a specific server just use $agents = Get-SCOMAgent | Where-Object {$_.DisplayName -eq “serverxy.domain.com”} instead $agents= Get-SCOMAgent in the script.
Cheers,
Stefan
Hi Stefan,
Thanks for this Reporting tool.
Can it be modified to ask for a specific Computer Group with in SCOM?
Thanks
Hi
Yes this is easily possible, you would have to just slightly modify the script the line $agents= Get-SCOMAgent to $agents = Get-SCOMGroup -DisplayName “All Windows Computers” | Get-SCOMClassInstance | Get-SCOMAgent and just replace the “All Windows Computers” name through your group name. I didn’t test it but it should work :).
Cheers,
Stefan
link doesnt allow me to download buddy, if possible can you mail me the same and also can you confrim does it use multiple threads to check the details or it checks one by one, also does it usage a server list to check all these details.
Hi
I just cheked the link works. It goes one by one in a “foreach” of course you could modify it to run in parallel. It uses the SCOM management server to query the server.
Cheers,
Stefan
there are servers that are showing up without a hostname
LIHBGLABWW03 Thursday, February 12, 2015 5:16:54 AM 7 Days 11 Hours 7 Minutes 179 Success True
LIHBGLABMD02 Thursday, February 12, 2015 4:14:35 PM 7 Days 0 Hours 10 Minutes 168 Success True
Thursday, February 12, 2015 4:14:35 PM 7 Days 0 Hours 10 Minutes 168 Success True
LIHBGLABAPE3 Wednesday, February 11, 2015 5:21:11 AM 8 Days 11 Hours 3 Minutes 203 Success True
Suggestions??
Moreover… can you sort the Servername column?
what to modified to make it work on SCOM2007R2. What is scom2007 class name for agent
Microsoft.SystemCenter.Agent
Great Report. Is there a way I could make the report provide Downtime instead of Uptime?
Hi
The data you want is probably best if you get the last heartbeat from the SCOM Agent from SCOM DB itself not from the Server you want to check. So, you can do it different ways, I would recommend using the Health Reports, cameron has once written a post about it http://blogs.catapultsystems.com/cfuller/archive/2010/08/16/quicktricks-last-agent-heartbeat/
Cheers,
Stefan
hi – link doesnt seem to work, can you repost please, or email it to me – looks great! thanks..
Hello, I would like to see the domains controller, how do I do? thank you for your script
Best Regards
Hi Stefan,
This is great script. Im unable to execute it on my SCOM 2012 setup, the script get executed without any error, but the report is empty. Pls help.
Regards,
Sameer
Hi Stefan,
how i can have a extra filed in a report for IP address colume and populate the IP address of agent in a report.
Thanks,
Anil
Hi Stefan,
Great report. Can you please help to make the report to send to email.As the content as email body.
Thank you for sharing the great work!
By any chance, do you have sql script for the same output?
Many Thanks!
Hi
No but you might want to check Kevins SQL Queries https://kevinholman.com/2016/11/11/scom-sql-queries/
Cheers,
Stefan
I’ve had this script lying around a bit and I’ve used it on several occasions, so thank you. Also not sure if you’re even monitoring these comments any more, but here goes.
I noticed that another commenter had the same issue I’m having – 22 servers out of ~450 show in the table with no server name. Running the script multiple times, I can see that it’s the same devices that are blank each time. Do you have any idea what causes this issue?