O'Reilly logo

Windows PowerShell™ 2 For Dummies® by Steve Seguis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 24. Managing Your Hardware

In This Chapter

  • Getting hardware information

  • Checking your hardware state

  • Managing your print queues

You can argue that software is what really makes a computer, but without the hardware, software would have no foundation to stand on. Even though virtualization has really taken off in recent years, in the end, you're still limited in functionality to the hardware that the software can access. This means that getting to know what hardware you're on can be very important.

In practice, you typically want to query hardware information for only two reasons: to generate an inventory of what devices you have installed or to find out whether some piece of hardware is installed to determine whether you should take some other action. If you can determine whether a device is a laptop based on the hardware installed, for example, you can do fancy things like run certain commands based on whether your PowerShell script is running on a laptop or a desktop.

In this chapter, you interrogate your hardware by querying a number of different WMI classes that deal with the different kinds of hardware on a computer. This is extremely important if you want to create proactive monitoring scripts that keep an eye on hardware errors. It's also very useful for generating hardware inventory if you want to create a crude asset management script. I also delve a bit into working with printers, including the ever-important monitoring of print queues (ever notice the chaos around the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required