Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

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

(image) 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(image) (image) (image) Hey, CB. Interesting question. We’re assuming that you’ve delegated control of Active Directory. User A, for example, has the ...

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

(image) Hey, Scripting Guy! Can I use a script to determine the size of a folder on a remote computer?-- SS(image) (image) (image) 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...

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

(image) Hey, Scripting Guy! Is there any way to determine the default printer on a computer?-- JW(image) (image) (image) 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. ...

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

(image) 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 or something, so that I don’t have to keep ...