W2KSG: Inventory Hardware

Most of the hardware connected to your system has a matching WMI class - cd, sound, keyboard, network adapter, printers and usb for example.  To find the appropriate WMI classes use

Get-WmiObject -List *networkadapter

Or similar

If you want to investigate the pointing devices try

Listing 8.4

Get-WmiObject -Class Win32_PointingDevice | Select HardwareType, NumberofButtons, Status, PNPDeviceId | Format-List

Oddly enough all the different devices report 0 butons!

It was pointed out on an earlier script that I could have effectively combined the select and format-list by changing the script to

Get-WmiObject -Class Win32_PointingDevice | Format-List HardwareType, NumberofButtons, Status, PNPDeviceId

The reason I don't do this automatically is that I usually leave the formatting until the end when I see what the default formatter produces and I find is easier (lazier :-) ) to just add format-list on the end.  Also if I want to put the script into PowerGUI not having the format-list makes life easier.

 

Share this post :

 

Technorati Tags: ,

Leave a Reply