ConfigMgr: Get Machine name from MIF files

This content originally appeared on moyerteam.com (no longer active) and has been reproduced with permission of the author, Jamie Moyer.

The following PowerShell script will extract machine names from all the MIF files in a given directory

Param($DirectoryToScan)

#recurse through MIFs and pull out computer name
dir -Recurse $DirectoryToScan -File -Filter *.MIF |`
Select-String -pattern "//KeyAttribute<NetBIOS Name><(?<computer>[\w]+)>" |`
%{$null = $_.Line -match $pattern; $matches['computer'] }