ConfigMgr MP Health Check Script | SCCM Endpoint Manager

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.

Latest Updated Script for SCCM Infrastructure monitoring and email alerts is available – SCCM Server Infrastructure Monitoring Script Without SCOM OpsMgr Automation

In this post, we will ConfigMgr SCCM MP Health Check Script for daily monitoring of SCCM components.

ConfigMgr MP Health Check Script | SCCM 

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

Patch My PC

Usage of SCCM MP Health Check Script

SLP-MP Health Check Script can be scheduled to run automatically with no user intervention. To run the SLP-MP Health Check Script, download the script with all supporting folders to the local drive. Set up a Windows scheduled task to run SLP-MP Health Check Script at the preferred interval.

How MP Health Check Script works?

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

Sample eMail alert :

ConfigMgr SCCM MP Health Check Script - ConfigMgr MP Health Check Script ConfigMgr MP Health Check Script | SCCM
ConfigMgr MP Health Check Script ConfigMgr MP Health Check Script | SCCM

How to get MP & SLP checks in Detail

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

Adaptiva

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 out any existing policy IDs (SoftwarePolicyID) in your environment and use the same for the MPPolicy checks.

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

2. The SLP check function is called for checking the SLP details for required servers. More information on SLP checks – See LINK

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 always 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 serves as a warning 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, an issue with the SQL server, or a problem with the SMTP mail server. In these cases, further investigation and intervention will be required.

In all other cases, the tool will send an email detailing the success and failures of that cycle. The log files stored in the “ActivityLog” folder are very helpful in troubleshooting the issues.

Sample Email 1 :

configmgr-sccm-slp-mp-health-check-script 0 ConfigMgr MP Health Check Script
ConfigMgr MP Health Check Script

Sample Mail 2 :

configmgr-sccm-slp-mp-health-check-script

Sample Mail 3 :

configmgr-sccm-slp-mp-health-check-script

GREEN The results of the checks are Successful.

YELLOW At least One check needs to be Successful.

RED All the three checks failed.

The activity checks logs will be created on the “ActivityLog” folder.

Sample Log :

configmgr-sccm-slp-mp-health-check-script

Prerequisites

– The Account should have access to SQL DB.

– Need to 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 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 for this script.

4. Change SLP check URL to reflect your AD Site if you’re using the AD site as SCCM/ConfigMgr boundary.

5. Change the Email configuration details – “SMTP Server Name,” “FROM” and “TO” MailIDs

Note! – The Alert Mail may be there in “Junk Email.” Just click “Not Junk” to get that in your INBOX!

configmgr-sccm-slp-mp-health-check-script

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 .

Author

Anoop is Microsoft MVP! He is a Solution Architect in enterprise client management with more than 20 years of experience (calculation done in 2021) in IT. He is a blogger, Speaker, and Local User Group HTMD Community leader. His main focus is on Device Management technologies like SCCM 2012, Current Branch, and Intune. E writes about ConfigMgr, Windows 11, Windows 10, Azure AD, Microsoft Intune, Windows 365, AVD, etc…

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

  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

This site uses Akismet to reduce spam. Learn how your comment data is processed.