Create a gist now

Instantly share code, notes, and snippets.

"Written by James Habben (@JamesHabben)"
"Last Updated: 2016-10-18"
""
""
"Start with device not inserted. Remove it now if it is in already."
read-host "press enter to continue"
$devices1 = Get-WmiObject Win32_PNPEntity
" Total devices before: {0}" -f $devices1.count
read-host "Insert device now, wait for devices to be installed, and then press enter"
$devices2 = Get-WmiObject Win32_PNPEntity
" Total devices after: {0}" -f $devices2.count
$diff = compare-object $devices1 $devices2
"==== Diff List ===="
$diff | format-list
"==== /Diff List ===="
"==== Long List ===="
foreach ($dev in $diff) {
$dev.inputobject
"---- ---- ----"
}
"==== /Long List ===="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment