SCCM admins have a lot of things to worry about. Software deployments, OS imaging, patching, the tasks can sometimes feel overwhelming. Tack on client health to that list of responsibilities and you'll seen feel like you're going insane.

What better way to ease the burden than with PowerShell. Here's a small script you can use to get a glimpse into hardware inventory problems.

When something goes wrong, SCCM places MIF files into the directory on the site server. This directory contains all kinds of different MIF files that couldn't be committed to the database for one reason or another. The MIF files are arranged in a way that the reason they weren't committed is the subdirectory of �that they're in. I needed a way to easily query all these MIF files to figure out which clients were having problems, when the problem happened and what the problem was. This script was my answer to that.

$FolderPath = '\CONFIGMGRSERVER\f$\CM2012\inboxes\auth\'

## Get all of the MIF files we'll be querying
$Mifs = Get-ChildItem $FolderPath -Filter '*.mif' -Recurse

## Find all the MIF files that match the regex string '//KeyAttribute<(.*)>'
$Matches = Select-String -Path $Mifs -Pattern '//KeyAttribute<(.*)>'
foreach ($Match in $Matches) {
    $FileProps = Get-Itemproperty $Match.Path
    ## Output an object containing the client name, time the file was created and why the MIF wasn't committed to the DB
        'Client' = $Match.matches.groups[1].Value
        'FileCreationTime' = $FileProps.CreationTime
        'MifProblem' = $FileProps.DirectoryName | Split-Path -Leaf

I hope that this saves you a little bit of time tracking down client health problems in SCCM!

Join the Jar Tippers on Patreon

It takes a lot of time to write detailed blog posts like this one. In a single-income family, this blog is one way I depend on to keep the lights on. I'd be eternally grateful if you could become a Patreon patron today!

Become a Patron!