System Center Configuration Manager – Powershell Query .MIF .SID and .SIC files in inboxes

The Issue

Is there a script that can ‘read’ through the Configuration Manager inboxes ( \Microsoft Configuration Manager\inboxes\auth\sinv.box\BADSinv) and can output/return a list of computer names which failed their software inventory?

There was a similar query that does this for Hardware Inventory by Querying *.MIF files

$ConfigMgrBoxPath = “C:\Program Files\Microsoft Configuration Manager\inboxes\auth\dataldr.box\BADMIFS”
Get-ChildItem -Path $ConfigMgrBoxPath -Include *.MIF -Recurse -Force -ErrorAction SilentlyContinue | ForEach-Object {
    $File = $_.FullName ;
    try {
        (
            Get-Content -ReadCount 1 -TotalCount 6 -Path $_.FullName -ErrorAction Stop  |
            Select-String -Pattern “//KeyAttribute<NetBIOS\sName><(?<ComputerName>.*)>” -ErrorAction Stop
        ).Matches.Groups[-1].Value
    } catch {
        Write-Warning -Message “Failed for $File”
    }
} | out-file -FilePath “c:\test\output.txt”

To read more about it click the link ( https://blogs.technet.microsoft.com/scotts-it-blog/2015/04/29/identifying-and-counting-computers-sending-badmif-files/ )

The Investigation

The issue with the above script is that Hardware Inventory (*.MIF) files are much better structured than Software Inventory files (*.SID, *.SIC)

MIF

Compared to

So I modified the original script to try and query *.SID files, but it failed, even after trying to learn String Patterns and Queries in REGEX ( https://regexr.com/)

The closest I got was the below, but this was still not good enough because when there are more than one set of dashes it doesn’t show the correct computer name.

The Solution

The final solution was simplifying the PowerShell script to the below

Removing the ‘#’ will run it and create a notepad called output.txt (make sure to specify the path)

$ConfigMgrBoxPath = “C:\Program Files\Microsoft Configuration Manager\inboxes\sinv.box\BADSinv”
Get-ChildItem -Path $ConfigMgrBoxPath -Include .SID,.SIC -Recurse -Force -ErrorAction SilentlyContinue | foreach {(Get-Content $_).Split("0″)[12]} | out-file -FilePath “c:\test\output.txt”

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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