Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Convert output of pnputil.exe to objects.
- ## Should work with any output where items are delimited by a blank line and the property name and value are delimited by a :
- <#
- Instance ID: PCI\VEN_17CB&DEV_010E&SUBSYS_00000000&REV_00\3&36cb97a3&2&00
- Device Description: PCI Express Root Port
- Class Name: System
- Class GUID: {4d36e97d-e325-11ce-bfc1-08002be10318}
- Manufacturer Name: (Standard system devices)
- Status: Started
- Driver Name: pci.inf
- Instance ID: HID\VID_046D&PID_C52B&MI_00\a&3081608f&0&0000
- Device Description: HID Keyboard Device
- Class Name: Keyboard
- Class GUID: {4d36e96b-e325-11ce-bfc1-08002be10318}
- Manufacturer Name: (Standard keyboards)
- Status: Started
- Driver Name: keyboard.inf
- #>
- $o = $null ; pnputil.exe /enum-devices /connected | Select -skip 2 | % { $f = $_.Trim() ; if( $f -match '^\s*$' ) { if( $o ) { $o ; $o = $null } } else { if( -Not $o ) { $o = New-Object pscustomobject }; if( $f.IndexOf( ':' ) -gt 0 ) { $s = ($f -split ':' , 2).Trim() ; Add-Member -InputObject $o -MemberType NoteProperty -Name $s[0] -Value $s[-1] } } }|ogv
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement