Updated: SCCM Health Check PowerShell Script

2 minute read

I have updated the SCCM Health Check Script that I have originally posted here.
Changes:
    1. The script can now utilise Powershell Remoting to check inboxes sizes. It requires PS-Remoting to be enabled on all SCCM Site Servers. This dramatically reduced the execution time of the script in a multi-tier environment. In a production environment that I support, it reduced the execution time from 1.5 – 2 hours to around 35 minutes!  You can configure which method to use via XML file. To enable, set <PSRemoting><Value> to Enabled. Or Disabled if you want to use the old Diruse.exe method.
2. Used another method instead of System.Net.DNS to perform DNS check (https://blog.tyang.org/2011/04/15/problem-with-dns-name-resolution-when-using-system-net-dns-class/) as System.Net.DNS does not provide accurate DNS lookup result.
3. Checks if DNS Host record exists in multiple domains (Domain suffixes are entered in XML file under <Configuration><DNSCheck><Suffix>).
image
– This might not be a requirement in your environment but I had to perform this check in the production environment that I support. If this is not required, Just leave it blank. The script will skip DNS Suffix check if <suffix> is left blank.
image
4. DNS check can be pretty time consuming because it connects to each site system’s WMI to check FQDN registered on the machine and it may not be a requirement in your environment. So I made an option to turn it off in the XML file (Under <Configuration><DNSCheck><Value>). To enable or disable it, set it to "Enabled" or Disabled" respectively.
5. Checks if there are multiple IPs registered in DNS (again, this is a requirement for me at work).
6. As requested by my friend Mr. Danovich, I’ve added an option to disable SQL checks (SQL Server logs, SQL Agent logs and SQL related warning and error logs in Windows Application event log). This is configured via <Configuration><SQLLogsCheck><Value> in the xml file.
7. Fixed a bug where if using .NET (System.Net.Mail) to send emails, the attachment is locked even after the script has ended. PowerShell console needs to be closed to remove the file handler.(This bug does not have any impact when you are using Windows Scheduler to run it because powershell.exe is terminated when the script is finished).
8. Fixed a bug where .NET framwork is not automatically loaded into PowerShell when PowerShell starts. The script now checks and load the assembly at the start of the script. It will terminate if fail to load .NET framework. So please make sure it is installed (enabled in Windows 2008).

Leave a comment