20

SCCM Health Check PowerShell Script Updated to Version 3.3

Posted by Tao Yang on 26/05/2011 in SCCM |

I have updated the SCCM Health Check Script again. The latest version is now 3.3.

Below is what’s been updated since my last post for version 3.1:

  1. Fixed the bug where when using DOTNET sending emails to multiple recipients, it only sends to the first recipient from the list.
  2. It now zip the txt attachment to zip file before sending it. this is to improve the performance and avoid sending large attachments.
  3. Added functionality to check all current active package distribution
  4. Able to create exemptions for DNS suffix check. This can be configured in the XML. (this is required at work as there a HOST record is created for central site server in another forest because there’s no forwarders setup between 2 forests.)
  5. Improved DNS checks
  6. Fixed the bug when SQL DB is not running under default instance. The script now reads SQL DB location from primary site server’s registry.

The script package now contains an additional file ICSharpCode.SharpZipLib.dll This is an open source project from sharpdevelop.net. This file is used to zip txt attachment.

The script now contains the following files:

image

I’ve also been told the DNS check does not work well when SQL DB is on a cluster. I don’t have access to a SQL cluster where I can diagnose the problem. So please just be aware.

The script can be downloaded here. Please remember to customise the “Health-Check.XML” file before running it.

Tags: , ,

20 Comments

  • glenn says:

    Do you have any examples to show the output of this script? Any prereqs? Do you run from the central site? Thanks for your help!

    • Tao Yang Tao Yang says:

      Hi Glenn,

      You can see a script print of the output email from the original post. you don’t have to run it on the central site server. but better to run it on a machine that is local to the central site server – for better performance. In terms of pre-reqs, other than what’s already documented in the original post, the account you run the script will also need to have local admin rights to all site systems- this is required as part of the DNS check (the script connects to each site system’s WMI to check the computer name).

  • Rajiv says:

    Hi Tao,

    The SCCM Health Check Script is a really a great tool and saves me a lot time having to find issues in my environment. I started running this tool on my tools machine against the central site and ran into issues. It seems to run 2 – 3 times without any issues but later I realiased that the script is actually killing the RPC server service on the Central Site and the server restarted for this reason.

    Do you know why this is happening?

    Thanks!

    Rajiv

    • Tao Yang Tao Yang says:

      Hi Rajiv, I’ve been running this in the production environment for over 6 month and did not run into any issues like what you’ve mentioned. it certainly uses RPC to connect to central site server and site provider for some checks, but it should not cause the RPC server to restart or crash. did you find anything in the system event log that are related to the restart of RPC service?

  • Rajiv says:

    Hi Tao,

    Thanks for your reply. This is the event which was logged after the server came back up.

    Log Name: System
    Source: USER32
    Date: 8/8/2011 1:15:59 AM
    Event ID: 1074
    Task Category: None
    Level: Information
    Keywords: Classic
    User: SYSTEM
    Computer: XXXXXX
    Description:
    The process C:\WINDOWS\system32\services.exe (XXXXX) has initiated the restart of computer XXXXXXX on behalf of user NT AUTHORITY\SYSTEM for the following reason: No title for this reason could be found
    Reason Code: 0×30006
    Shutdown Type: restart
    Comment: Windows must now restart because the Remote Procedure Call (RPC) service terminated unexpectedly
    Event Xml:

    1074
    4
    0
    0×80000000000000

    15275
    System
    XXXXXXXXXX

    C:\WINDOWS\system32\services.exe (XXXXXXX)
    XXXXXX
    No title for this reason could be found
    0×30006
    restart
    Windows must now restart because the Remote Procedure Call (RPC) service terminated unexpectedly
    NT AUTHORITY\SYSTEM
    06000300000000000000000000000000000000000000000000000000000000000000000000000000

    After googling for this error I found there is a hotfix and have applied the same to my Central Site. Hopefully that would fix the issue.

    Here is the hotfix information:

    http://support.microsoft.com/default.aspx?scid=kb;en-US;2401588

    Thanks & Regards,
    Rajiv

  • Rajiv says:

    Tao,

    I have one more issue… The script is not able to pull the Inboxes backlog even when I set the Threshold as low as 5. After looking at the report it gives me a error – “not accessible. please check!” What should I check? The user under which the script is running has FULL ACCESS to SCCM.

    Appreciate your suggestions in this regards. Thanks, Rajiv!

    BTW the hotfix seems to have fixed my RPC issue.

    • Tao Yang Tao Yang says:

      Hi Rajiv, Are you using diruse.exe or using PS Remoting to check inboxes? If you set to use PS Remoting in the XML, did you enable WinRM on all site servers? Are you running it via Task Scheduler when you running into this issue? What happens if you change $ErrorActionPreference=”Continue” at the very top of the script and run it manually under your admin account? what error message did you get on the powershell console?

      • Rajiv says:

        Toa, I am using PS Remoting and have enabled WinRM on a couple of sites to see if it works but then it gives the same error for those sites too. I am currently running the script manually. I will try to change $ErrorActionPreference=”Continue” and see if that makes a difference. I dont see any error message on the powershell console as well. It just says that it is trying to check the Inboxes on the powershell console.

  • Rajiv says:

    Here is the error that I see on the PS console.

    My SCCM installation is on the G drive and looks like it does not like that.

    ==============================================================
    Join-Path : Cannot find drive. A drive with the name ‘G’ does not exist.
    At C:\PsTools\SCCMHC\SCCM-HealthCheck.ps1:1284 char:30
    + $SCCMInboxesDir = Join-path <<<< ((Get-WmiObject Win32_share -ComputerName $site.ServerName | Where-Object {$_.Path -eq $site.InstallDir}).path) "inboxes"
    + CategoryInfo : ObjectNotFound: (G:String) [Join-Path], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.JoinPathCommand

    * inboxes location: on XXXXXXXX
    Cannot bind argument to parameter 'Path' because it is null.
    + CategoryInfo : InvalidData: (:) [Test-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.TestPathCommand
    ===================================================================

  • Daryl Bizsley says:

    Hi,

    The script is working for me when run manually, however when set to run as a scheduled task the script doesn’t report information for the server in the primary site server section of the XML.

    MY SERVER NAME HERE

    It does however pick up the database server and extra site Servers no specified in the XML.

    Any ideas on this?

    • Tao Yang Tao Yang says:

      The script locates the SMS provider server from site server’s WMI repository (the site server you specify in XML). then get a list of site systems from SMS provider via WMI. so if it gets other site systems and SQL servers, the primary site server you specified in XML should be valid.
      When you run it via scheduler, does the user account that runs under have sufficient rights in SCCM, SQL and Windows OS?

  • Michael Colben says:

    On the report, there is a section called “Site Systems with issues.” It list the roles of the servers with issues, but it does not list the site server name. How do I add the server name?

    The SMS Component Server and the SMS Distribution Point Directories, which directories are you looking at (SMSPKG maybe) and how do you determine Percentage Free?

    Example of report listed below.

    Site Systems with issues

    SiteCode Role ObjectType PercentFree Status
    ——– —- ———- ———– ——
    ATC SMS Component Server Directory -1 Critical
    ATC SMS Component Server Directory -1 Critical
    ATC SMS Distribution Point Directory 83 Warning
    ATC SMS Distribution Point Directory 53 Warning
    ATC SMS Distribution Point Directory 87 Warning
    ATC SMS Distribution Point Directory 96 Warning
    ATC SMS Distribution Point Directory 86 Warning
    ATC SMS Distribution Point Directory 52 Warning
    ATC SMS Distribution Point Directory 90 Warning
    ATC SMS Distribution Point Directory 98 Warning

    • Tao Yang Tao Yang says:

      Hi Michael,

      Thanks for pointing it out. I should be able to add the site system name to it. I’ll do it in the next couple of days and post a new version with couple of other updates.

      Thanks
      Tao

      • Betrisey Cedric says:

        Hi Tao,

        Would it be possible to include a feature that allow to run script only on a certain number of sites (i.e Primary servers only, or secondary servers only) ?

        It would also be great if we can filter out the BDP from DP status ?

        YOur tool is great anyway!!!

        Rgds
        Cedric

  • Tao Yang Tao Yang says:

    I’ve just updated this script to version 3.5. The new version can be found here: http://blog.tyang.org/2012/01/31/sccm-health-check-script-updated-version-3-5/

  • Khaled says:

    I configured the sending email option but it is not working with me !

    is there any tips ?

    Warm Regards

Leave a Reply

Copyright © 2010-2014 Tao Yang's System Management Blog All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.2.4.1, from BuyNowShop.com.