Scripting Blog

A place to learn about PowerShell and share stories of automation

How Can I Determine if My Users Have Certain Files on Their Computers?

Hey, Scripting Guy! Is it possible to search a computer for .MP3 files or other files my users aren’t supposed to have?-- AK Hey, AK. Once again it’s WMI to the rescue. Using the CIM_DataFile class it’s easy to search a computer for specific file types. Want to know if your users have any .MP3 files lying around? Then just use a ...

Why Doesn't My LIKE Query Work on Windows 2000?

Hey, Scripting Guy! I’m trying to use a LIKE query in my WMI scripts. The query works fine on Windows XP computers, but I can’t get it work on Windows 2000 computers. Do you know what I’m doing wrong?-- GS Hey, GS. Actually you’re not doing anything wrong. You’re using a script similar to this, which uses the LIKE operator to search...

How Can I Tell Which Account a Service is Running Under?

We have services that run under a particular user account. Each time we change the password for that user account, we need to change the password for any services that run under that account as well. But how can we tell which account a service is running under?-- SA Hey, SA. By and large WMI is a pretty transparent technology. To manage ...

Why am I Getting an Error when Trying to Determine an IP Address?

Hey, Scripting Guy! I’m trying to determine the IP address on a computer, but I keep getting a Type Mismatch error. Do you know why? -- AQ, Jacksonville, FL Hey, AQ. As a matter of fact, we do know why you’re getting a Type Mismatch error, and it’s a common problem when working with the WMI class Win32_NetworkAdapterConfiguration. The ...

Registry Script Doesn't Work

Hey, Scripting Guy! I tried writing a script to read data from the registry, but I keep getting this error:   Do you have any idea what's wrong? I'm running Windows XP Professional, Service Pack 1, and this is the code I'm using: -- LW, Omaha, NE Hey, LW. The error you are getting (80041010) means that the specified class (in this case...

Feedback usabilla icon