ConfigMgr MP Health Check Script | SCCM

ConfigMgr MP Health Check Script | SCCM. I want to share a very useful script to check the availability/functionality of Management Point (MP) in a ConfigMgr environment.

The SLP-MP Health Check Script is designed to be easily automated, requiring no user manual intervention. First, to initiate the script, download it with all its supporting folders onto the local drive.

Subsequently, set up a Windows scheduled task to execute the script at the specified intervals, ensuring that regular health checks are carried out seamlessly.

In this post, we will configure the SCCM MP Health Check Script to monitor SCCM components daily.

Patch My PC
Index
ConfigMgr MP Health Check Script | SCCM 
Usage of SCCM MP Health Check Script
How does the MP Health Check Script work?
How to Get MP & SLP Checks in Detail
SCCM MP Health Check Script Error Handling
Prerequisites
ConfigMgr MP Health Check Script | SCCM – Table 1

ConfigMgr MP Health Check Script | SCCM 

https://github.com/AnoopCNair/SCCM-MP—Health-Check-and-Email-Notification-script

Usage of SCCM MP Health Check Script

The SLP-MP Health Check Script can be scheduled to run automatically with no user intervention. Download the script and all supporting folders and run it to the local drive. Then, set up a Windows scheduled task to run the script at the preferred interval.

How does the MP Health Check Script work?

The SLP-MP Health Check Script will connect to SCCM/ConfigMgr DB and run an SQL query to fetch the list of servers with MP and SLP roles installed. The query will return SiteCode, ServerName, and RoleName details. These details are furnished in a tabular format (with the test results of MP/S and SLP/S) and sent via email alert to receipts.

Sample eMail alert :

ConfigMgr MP Health Check Script | SCCM - Fig.1
ConfigMgr MP Health Check Script | SCCM – Fig.1

How to Get MP & SLP Checks in Detail

The server details are stored in an array. Each array entry is called using the FOR loop, and Individual checks are carried out below.

1. The MP check function is called to run the below checks for each server with the MP role installed.

MPListURL = "http://" & StrMPServer & "/SMS_MP/.sms_aut?mplist"
MPCertURL = "http://" & StrMPServer & "/SMS_MP/.sms_aut?mpcert"
MPPolicyURL = "http://" & StrMPServer & "/SMS_MP/.sms_pol?" & SoftwarePolicyID

Note! – Change the constant value of SoftwarePolicyID = “C0100000-C0100000-2D40483D.1_00” used in the script. Use the PolicySpy tool to find any existing policy IDs (SoftwarePolicyID) in your environment and use them for the MPPolicy checks.

A separate advertisement can be created to conduct MPPolicy checks. You can use the PolicySpy tool to find the Policy ID details of the new ad.

2. The SLP check function is called to check the SLP details for required servers.

SlpURL = "http://" & SMSStrServerName & "/sms_slp/slp.dll?site&ad="

These results will be stored in a different array and will be used at the time of creating the output file.

SCCM MP Health Check Script Error Handling

The script sends an email every time it runs, even if there are no errors in the MP and SLP list, so the absence of an email warns that the tool may have failed. There are some instances where this could happen—if the server the tool is scheduled to run on is down, if there is an issue with the SQL server, or if there is a problem with the SMTP mail server. In these cases, further investigation and intervention will be required.

In all other cases, the tool will email detailing the cycle’s successes and failures. The log files stored in the “ActivityLog” folder are beneficial in troubleshooting issues.

Sample Email 1 :

ConfigMgr MP Health Check Script | SCCM - Fig.2
ConfigMgr MP Health Check Script | SCCM – Fig.2

Sample Mail 2 :

ConfigMgr MP Health Check Script | SCCM - Fig.3
ConfigMgr MP Health Check Script | SCCM – Fig.3

Sample Mail 3 :

ConfigMgr MP Health Check Script | SCCM - Fig.4
ConfigMgr MP Health Check Script | SCCM – Fig.4
  • GREEN: The checks were successful.
  • YELLOW: At least One check needs to be Successful.
  • RED: All the three checks failed.
  • The activity check logs will be created in the “ActivityLog” folder.

Sample Log :

ConfigMgr MP Health Check Script | SCCM - Fig.5
ConfigMgr MP Health Check Script | SCCM – Fig.5

Prerequisites

  • The Account should have access to SQL DB.
  • Create two blank folders, “SummaryHTM” and “ActivityLog.” These folders are used to store the log and HTM files. (You can download the zip file and extract it. This will automatically create the required folders)
  • FIVE changes you need to make before running the script.
  1. Replace “DATABASE-SERVER-NAME” with DB server name/instance. e.g StrSMSDBServer = “DATABASE-SERVER-NAME”
  2. Replace “SMS_SiteCode” with the database name. e.g StrSiteDB = “SMS_SiteCode”
  3. Change the constant value SoftwarePolicyID = “C0100000-C0100000-2D40483D.1_00” used in the script and use the PolicySpy tool to find out any existing policy ID (SoftwarePolicyID) in your environment and use the same for the policy test. Or Create a new Package, Program, Advertisement, and Collection to create a new PolicyID dedicated to this script.
  4. If you’re using the AD site as an SCCM/ConfigMgr boundary, change the SLP check URL to reflect it.
  5. Change the email configuration details to “SMTP Server Name,” “FROM”, and “TO” Mail IDs.

Note! The Alert Mail may be in “Junk Email.” Just click “Not Junk” to get it in your inbox!

ConfigMgr MP Health Check Script | SCCM - Fig.6
ConfigMgr MP Health Check Script | SCCM – Fig.6

Note – This post is provided “AS IS” with no warranties, confers no rights, and is not supported by the author. I’m not sure about the origin of this script.

We are on WhatsApp. To get the latest step-by-step guides and news updates, Join our Channel. Click here –HTMD WhatsApp.

Author

Anoop C Nair has been Microsoft MVP from 2015 onwards for 10 consecutive years! He is a Workplace Solution Architect with more than 22+ years of experience in Workplace technologies. He is also a Blogger, Speaker, and leader of the Local User Group Community. His main focus is on Device Management technologies like SCCM and Intune. He writes about technologies like Intune, SCCM, Windows, Cloud PC, Windows, Entra, Microsoft Security, Career, etc..

24 thoughts on “ConfigMgr MP Health Check Script | SCCM”

  1. Hello Anoop,

    I wanted to emplent the script you created but I was unsure how to find the softwarePolicyID using PolicySpy, please can you provide instructions on how to do this?

    Regards

    Reply
  2. Hello Anoop,

    Do you have a version that only sends the email IF a status is Red or Yellow? Also what is your preferred interval?

    Thanks!

    Reply
  3. I ran your script on SCCM 2012 R2, but the SoftwarePolicyID portion is failing. I download the policyspy and used the following ID:

    PolicyID=”DEP-USD2007A-CN1001E7-6DFC29BE”,PolicySource=”SMS:USD”,PolicyVersion=”1.00″

    Any help is appreciated.

    Thanks!

    Reply
      • I used the policyspy and this is the output below. I used that ID and the script is not pulling back any information. Is this ID correct?

        Version 5.0.7958.1000
        Copyright © Microsoft Corporation. All rights reserved.
        PolicyID=”DEP-USD2007A-CN1001E7-6DFC29BE”,PolicySource=”SMS:USD”,PolicyVersion=”1.00″

      • I’ve never tested this in CM12. Have you noticed a change in policy ID mentioned in the post “SoftwarePolicyID = “C0100000-C0100000-2D40483D.1_00″” and the policy ID “PolicyID=”DEP-USD2007A-CN1001E7-6DFC29BE”” in your reply. Probably policy version is missing? Do you think, it’s worth a try with version number ? I couldn’t recollect this the difference between SCCM 2007 and SCCM 2012 policy numbers !!
        Regards
        Anoop

  4. Hi Anoop,

    Will this script work on SCCM CB 1706 ?
    Because when I manually try the MP url its working fine but the report shows as RED.

    Reply
  5. Hi Anoop ,

    Getting error as object required in line 129 for StrwriteOutput results. Error is object required and code 800A01A8, Kindly advice.

    Thank You.

    Regards,
    S.Yuvaraj

    Reply

Leave a Comment