Skip to content

Instantly share code, notes, and snippets.

@minkione
Forked from JamesHabben/diff-pnp-devices.ps1
Created March 26, 2017 06:40
Show Gist options
  • Save minkione/e53468cad54528698c8016c1f7737d35 to your computer and use it in GitHub Desktop.
Save minkione/e53468cad54528698c8016c1f7737d35 to your computer and use it in GitHub Desktop.
"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