ConfigMgr SCCM MP Health Check Script

23

I would like to share a very useful script to check the availability/functionality of Management Point (MP) and Server Locator Point (SLP) in a ConfigMgr environment. In this post, we will ConfigMgr SCCM MP Health Check Script for daily monitoring of SCCM components.

Download  MP Health Check Script 

https://social.technet.microsoft.com/wiki/contents/articles/6753.configmgr-sccm-slp-mp-health-check-script.aspx

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 folder s 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 send across an eMail alert to receipts.

Sample eMail alert :

ConfigMgr SCCM MP Health Check Script

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 in the below fashion.

1. The MP check function is called to run the below checks for each server with 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 PolicySpy tool to find out any of the existing policy ID (SoftwarePolicyID) in your environment and use the same for the MPPolicy checks.

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

2. The SLP check function is called for checking the SLP details for required servers. More details 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 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 completely. There are some instances where this could happen – if the server the tool is scheduled to run on is down or if there is an issue with the SQL server or if there is an issue 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 for that cycle. The log files stored in “ActivityLog” folder is very helpful in troubleshooting the issues.

Sample email 1 :

configmgr-sccm-slp-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 PolicySpy tool to find out any of the existing policy ID (SoftwarePolicyID) in your environment and use the same for policy test. Or Create 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 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 E-mail”. 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 .

23 COMMENTS

  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

  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!

  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!

      • 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.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

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