In this post I would like to show you what the benefit is of having PowerShell integration in dashboards. The days before having the PowerShell widgets you mostly needed to export your PowerShell queries / results into some sort of text file / Excel sheet etc. to display the result. For example a common request is to have a list of grey agents or list all agents that do not have the proxy setting enabled on your monitored agents etc. Because of that I created some sort of health check dashboard which let’s you display common request in one single spot.
The requests I get a lot are:
- Display all servers from the domain which do not have a SCOM agent installed
- Display all agents which do not have an Active Directory computer account. E.g. this means either there is a server decommissioned but the agent is not deleted in SCOM.
- Display all grey agents which the watcher node cannot contact.
- Display agents which do not have the proxy setting enabled.
I created a simple grid dashboard with 4 cells…
For the first widget I query the current Active Directory and compare the list of servers / computers returned against the installed agents. This will return the computers which do not have a SCOM agent installed. The second widget does the opposite and compares the installed SCOM agents against the Active Directory computer accounts in the current domain. This means there is something “fishy” because you have a SCOM agent object in SCOM but no corresponding computer object in the current Active Directory. This could be because the server has been decommissioned and the SCOM agent not deleted or it will also show agents from the other domain than you are currently logged in. The third widget shows simply agents which are in a grey state and cannot be contacted by the watcher object anymore. The fourth widget lists all agents that are not proxy enabled.
For querying the Active Directory I am not using any Active Directory cmdlets like Get-ADComputer instead I use the System.DirectoryServices.DirectorySearcher object. This way we do not depend on any cmdlets. These are just samples and are useful for a single domain scenario, if you have multiple domains / forests etc. you need to extend the scripts.
My goal is to show you what can be done, deliver some ideas what can be useful in daily life and how cool the PowerShell widgets are.
You can download the scripts for these PowerShell Grid Widgets here.