Scripting Blog

A place to learn about PowerShell and share stories of automation

How Can I Determine the Current Screen Resolution Being Used on a Computer?

Hey, Scripting Guy! How can I determine the current screen resolution being used on a computer? You know, things like 1600x1200 resolution, 16-bit color, that kind of information.-- FE Hey, FE. Remember when you were a kid and your mom would have that annoying habit of beginning a discussion by answering the question you didn’t ask? For ...

How Can I Determine Which USB Devices are Connected to a Computer?

Hey, Scripting Guy! How can I determine which USB devices are connected to a computer?-- WM Hey, WM. If you watch a lot of TV - um, not that the Scripting Guys do; we spend our spare time reading the works of Shakespeare, solving differential equations, and otherwise tending to our many intellectual pursuits. As we’ve been told, however, ...

How Can I Tell If a File Exists on a CD or DVD Drive?

Hey, Scripting Guy! How can I tell whether a file exists on any CD or DVD drive connected to a computer?-- GH Hey, GH. Well, one way to do this would be to search the entire file system - including any mapped network drives - and check to see if a file (let’s call it Budget.xls) can be found anywhere. Assuming you find such a file, you ...

How Can I Determine if a Computer is a Laptop or a Desktop Machine?

Hey, Scripting Guy! Is there any way to use WMI to determine whether a computer is a laptop or a desktop machine?-- CB Hey, CB. You bet there is, although if you didn’t know that we have no idea how you’d figure it out on your own. It turns out there’s a goofy little WMI class called Win32_SystemEnclosure, and the ChassisTypes property ...

How Can I Tell if a Computer Has a DVD Drive Installed?

Hey, Scripting Guy! How can I tell if a computer has a DVD drive installed?-- GC Hey, GC. No doubt you’re hoping we’ll say something like, “Why, you just use the Win32_DVD class, of course.” Unfortunately, though, we can’t say that; that’s because there is no Win32_DVD class, or any class devoted to DVD drives. There is, of course...