Can I Edit .INI Files Using a Script?

Hey, Scripting Guy! Can I edit.INI files using a script?— MZ Hey, MZ. Yes, you can edit .INI files (or any kind of text files, for that matter) using a script. The method you have to use might not be the most elegant process in the world, but it’ll work. And that’s all we really… Read more

How Can I Attach a File to an Email Sent Using CDO?

Hey, Scripting Guy! I understand how to use CDO to send an email, but how do I include an attachment with that email?— RT Hey, RT. And, incidentally, thanks for this question. At least one of the Scripting Guys spent most of his Thanksgiving weekend eating and, on the rare occasions when he wasn’t eating,… Read more

How Can I Retrieve Disk Quota Information for a Single User?

Hey, Scripting Guy! How can I retrieve disk quota information for a single user?— AB Hey, AB. There are a couple different ways to get disk quota information for a single user, depending on which version of Windows you have installed on the computer. If you’re running Windows XP or Windows 2003, you can retrieve… Read more

How Can I Run a Script Against a Range of IP Addresses?

Hey, Scripting Guy! I’d like to run a script against all the computers on a subnet. Is there a way to do that without having to hardcode all the IP addresses into the script?— RB Hey, RB. Based on your email, it sounds like you have a setup similar to this: you have a subnet… Read more

How Can I List the Members of a Group in Alphabetical Order?

Hey, Scripting Guy! I have a script that returns the names of all the users in an Active Directory group. How can I sort those names in alphabetical order? — JW Hey, JW. Ah, yes, sorting data: the bane of script writers everywhere. Unfortunately, VBScript doesn’t have a built-in sorting mechanism, and neither does ADSI…. Read more

How Can I Put New Users in the Same OU as the Person Creating Their Accounts?

Hey, Scripting Guy! We use a script to create user accounts. How can I modify this script so that it will place the new user in the same OU as the person running the script?— CB Hey, CB. Interesting question. We’re assuming that you’ve delegated control of Active Directory. User A, for example, has the… Read more

Can I Use a Script to Determine the Size of a Folder on a Remote Computer?

Hey, Scripting Guy! Can I use a script to determine the size of a folder on a remote computer?— SS Hey, SS. Boy, you’d think you’d be able to do that, wouldn’t you? Especially if you’ve glanced through the WMI class Win32_Directory and noticed the property FileSize. Based on that, you might think, “Well, obviously… Read more

Hey, Scripting Guy! Is There Any Way to Determine the Default Printer On a Computer?

Hey, Scripting Guy! Is there any way to determine the default printer on a computer?— JW Hey, JW. If you’re running Windows XP or Windows Server 2003, determining the default printer is easy. That’s because the WMI class Win32_Printer found on these versions of Windows includes a property named Default. As the name implies, this… Read more

Can I Read an Entire Text File Rather Than Reading It Line-by-Line?

Hey, Scripting Guy! Right now I use a script to open a text file containing computer names. The script reads the first line of the file and connects to that computer, then reads the second line of the file and connects to that computer. Is there a way to store those names in a variable… Read more

Can I Lock a Workstation Using a Script?

Hey, Scripting Guy! I know how I can shut down a computer using a script, and I even know how I can log a user off using a script. But is there any way I can lock a workstation using a script?— TO-R Hey, TO-R. Most likely you’re familiar with the Win32Shutdown method found in… Read more