Extracting Device Names from Bad MIFs in ConfigMgr

If you are here, you either know what a BADMIF is or Google brought you here after you searched for something like “Large number of BADMIFS” or “Can I delete BADMIFS” or something like that. Anyway, if you want great info on what MIFs are and some great in-depth troubleshooting steps for them, you should check out Umair Kahn’s post over on Tech Community (migrated from Technet). It’s a bit old, but still very relevant.

This post is to simply share a script that I wrote as I was dealing with a large quantity of bad MIFs. I actually used Umair’s to help with the process but ultimately wanted to clear out all of the backlogged MIF files stuck in the <installdir>\Program Files\Microsoft Configuration Manager\inboxes\auth\dataldr.box\BADMIFS folder on my ConfigMgr site server.

I had recently made some changes to client inventory and they were causing an unusual amount of MIFs to fail when being processed on the server. Before I removed them, I wanted to know which machines had created them to see if I could see a pattern or find repeat offenders. The script is very simple. It gets all of the MIFs in the BADMIFs folder and parses the content of them to determine the computer name in the file.

Here’s an example of the beginning of a MIF file. As you can see, NetBIOS name is listed on the 4th line. The script looks for that line and extracts the devicename.

$DeviceName = ($File | Get-Content -ReadCount 1 -TotalCount 6 -ErrorAction Stop  | Select-String -Pattern "//KeyAttribute<NetBIOS\sName><(?<ComputerName>.*)>" -ErrorAction Stop).Matches.Groups[-1].Value

The output will show you the Device Name, Type of “badness” and the Path to the bad MIF.

Warning: You may want to make a copy of the BADMIFS directory and change the path to use your copy so you aren’t reading in live MIF files and potentially causing issues on your production server. You’ve been warned.

You can grab a copy of the latest version of the script on my GitHub repo here.

No Comments

Comment

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

413