Powershell – SCCM 2102 R2 BADMIF File From what Computer

SCCM 2012 R2 – If you look at a badmif file you can tell which computer it came from. This powershell script reads all the badmif files and tells you what computer are generating them on what dateBy default SCCM 2012 R2 deletes old BADMIF files after 14 days, so you don’t run out of disk space, but what it does mean is those computers that have badmifs do not update their information in SCCM.

In my case my BADMIFs were oversize and that was due to  too many user profiles on the computers in question. We had maxed out the file size that SCCM would accept to 50MB, but some were up to 100MB…
I had some computers that had been used over the last few years by 500 to 1,200 individual users…….. and that was the reason for the large files…more later as to how to fix that!

Anyhow this script is simple:

  1. you will need to change the path to the BADMIF folder
  2. Basically all I do is get a list of the files
  3. Use get-content to return the first two lines (saves reading all the file in)
  4. I know the Computername is the first thing in the second line. In my case the computername is 9 characters long, so you may have to change this
  5. I then pipe the $Output via a sort filter two ways.
    1. the first to sort by the last write time
    2. the second by the computername

This second is just so I can see if there is a computer reporting in frequently than the default time period. This may indicate issues with the SCCM client on the computer

 

 $ListOfFiles = get-childitem -File -path '\\ServerName\d$\Program Files\Microsoft Configuration Manager\inboxes\Auth\dataldr.box\badmifs'
$Output = foreach ($item in $ListOfFiles)
{
$Result = New-Object -TypeName psobject
$Lines = get-content  -path $item.fullname -totalcount 2
$ListOfThings = @{
'Computername'  = $Lines[1].Substring(0,9)
'LastWriteTime' = $item.LastWriteTime
'Fullname'      = $item.Fullname

}
$result |add-member -NotePropertyMembers $ListOfThings
$result
}
$Output.count 
$Output |Sort-Object -Property Lastwritetime,Computername 
$Output.count 
$Output |Sort-Object -Property Computername,Lastwritetime

 

Leave a comment

Your email address will not be published. Required fields are marked *

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