How Do I Bind to a User Account in a Sub-OU?

Hey, Scripting Guy! How do I bind to a user account when the user is in a sub-OU? Code like this doesn’t work: LDAP://CN=Ken Meyer, OU=NA\Human Resources, DC=fabrikam, dc=com.– RD Hey, RD. The past few days we’ve done some lengthy answers to questions, so we decided to be a little lazy today (hey, it is…


How Do I Get Rid of Extraneous Spaces in a String?

I know that I can use the Split command to separate a sentence like this – VBScript is fun! – into an array of individual words. However, what happens if I have a sentence like this: VBScript is fun! I can’t use a blank space as the delimiter because I might have lots of blank…


How Can I Use Both Command-line Arguments and a Default Value?

Hey, Scripting Guy! I’d like to have a script that accepts computer names as command-line arguments and then runs against each of those computers. However, if you don’t enter any command-line arguments, I’d like it to default to running against the local computer. Can you help me out here?– TS Hey, TS. Sure, we can…


Why Doesn’t My Ping Script Run on Windows 2000 Computers?

Hey, Scripting Guy! I have a script that pings a computer before it tries to connect to it. The script works fine on Windows XP, but doesn’t work at all on my Windows 2000 computers. Do you have any idea why?– AK Hey, AK. As a matter of fact, we do have an idea why….


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,…


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…


How Can I Read in IP Addresses and Use Them in a Script?

Hey, Scripting Guy! I have a text file that contains a bunch of IP addresses. I’d like to be able to read these addresses from a script, and then use them to connect to those computers. Is that possible?– RL Hey, RL. You bet you can do this, and here’s how. First, make sure your…


How Can I Determine the Version Number of an Executable File?

Hey, Scripting Guy! How can I determine the version number of an executable file?– TW Hey, TW. Well, that depends. If the file is located on the local computer, the easiest way is to use the FileSystemObject. Have a burning desire to know which version of Regedit.exe is installed on your computer? All it takes…


How Can I Tell if a Server has Rebooted?

Hey, Scripting Guy! Is there any way to tell whether or not a server has rebooted?– MvdM Hey, MvdM. We’re assuming that you’re performing a task and, at the end of the task, the computer is supposed to reboot. Needless to say, you want to know, “Well, did the server reboot?” How can you tell…


How Can I Be Notified Any Time a Service Goes Down?

Hey, Scripting Guy! How can I be notified any time a service goes down?– RN Hey, RN. As usual, there are a couple different ways you can do this, but perhaps the simplest approach is to create a script that monitors WMI events. We don’t have time to do a detailed explanation of WMI events…