Get CM Inventory - Skatterbrainz/CM_HealthCheck GitHub Wiki

Overview

This script is part 1 of a 2-part process for generating an audit report of a System Center Configuration Manager site environment. Export-CM-HealthCheck.ps1 is part 2. This script gathers data and creates a folder below the location where this script is executed from. The sub-folder tree will be in the format of "YYYY-MM-DD\server.domain.suffix". Another folder named "_Logs" will be created just below the execution path as well, and contains a copy of verbose output for diagnostics and troubleshooting.

  • Extract Get-CM-Inventory.ps1, messages.xml and cmhealthcheck.xml into a folder.
  • Open a PowerShell console using "Run as administrator"
  • Run the script (examples shown below)
  • This script is based on the awesome work of Rafael Perez (rflsystems.co.uk)

Notes / Requirements

  • Must be executed using an account which has FULL ADMINISTRATOR permissions to the SCCM hierarchy, the Windows Server host, and the SQL Server instance which supports the SCCM hierarchy.
  • Requires PowerShell version 3 or later
  • Works best when executed ON the SCCM Primary or CAS for a given hierarchy
  • Has been tested on SCCM 2012 SP1, 2012 R2, 1511, 1602, 1606, 1610, 1702 and 1704
  • The purpose of the -NoHotFix parameter is to bypass the auditing of installed hotfixes, which tends to be the most time-consuming portion of the collection process. I DO NOT recommend using this on the first-pass of collecting data. This is intended for a second-pass, when performing a comparison of the current state with a previous state. In most cases this is after remediation work has been completed following a prior audit report.

Syntax Examples

  • Get-CM-Inventory.ps1 -SmsProvider cm01.contoso.com
  • Get-CM-Inventory.ps1 -SmsProvider cm01.contoso.com -Overwrite -Verbose
  • Get-CM-Inventory.ps1 -SmsProvider cm01.contoso.com -NoHotFix -Verbose
  • $SiteServers | Get-CM-Inventory.ps1

Version Updates / Change Log

Version 0.1 - Raphael Perez - 24/10/2013

  • Initial Script

Version 0.2 - Raphael Perez - 05/11/2014

  • Added Get-MessageInformation and Get-MessageSolution

Version 0.3 - Raphael Perez - 22/06/2015

  • Added ReportSection

Version 0.4 - Raphael Perez - 04/02/2016

  • Fixed issue when executing on a Windows 10 machine

Version 0.5 - (4/11/2017)

  • Changed "cm12R2healthCheck.xml" to "cmhealthcheck.xml"
  • Detailed is now a [switch] instead of a [boolean]
  • Minor bugfixes throughout

Version 0.6 - David Stein (4/17/2017)

  • Formatting updates, documentation

Version 0.61 - David Stein (5/16/2017)

  • Added -NoHotFix option
  • Removed Test-PowerShell function dependency
  • Incremented version from 0.51 to 0.6 for consistency

Version 0.62 - (5/19/2017)

  • Fixed bug with -NoHotFix [switch] typo
  • Added pipeline support for SmsProvider parameter

Version 0.63 - (5/22/2017)

  • Fixed bug with type cast Int32
  • Corrected "Secion" to "Section" (minor change)

Version 0.64 - (5/22/2017)

  • Bug fix in Catch{} section of Get-SqlData to rename $ComputerName to $ServerName