How Can I Enumerate All the Objects in an Active Directory OU?

Hey, Scripting Guy! How can I enumerate all the objects in an Active Directory OU?— RB Hey, RB. By the way, thanks: it’s always nice to get an easy question every once in awhile! Enumerating all the objects in an OU is almost embarrassingly-simple: by default, any time you bind to an OU using ADSI…


How Can I Create a Folder on a Remote Computer?

Hey, Scripting Guy! Can I create a folder on a remote computer using a script?— AN Hey, AN. Life is full of mysteries. To name one, what possessed somebody to think that the world was clamoring for Clamato juice, an unholy concoction combining tomato juice and clam juice? (As long as we’re on the subject:…


How Can I Prompt a User for Input?

Hey, Scripting Guy! I need my script to prompt users to enter some information, like the name of the file they want to create. How do I do that?— RW, Williamsport, PA Hey, BN. The simplest – and most foolproof – way to do this is to use an InputBox; when you do that users…


How Can I Stop a Script Partway Through?

Hey, Scripting Guy! Is there a way to make a script stop itself if certain conditions aren’t met? Like say I’m going to copy files to a remote computer, but then the remote computer isn’t available. Can I write code that tells the script to just go ahead and quit at that point?— WK, Palo…


How Can I Determine the Day of the Week?

Hey, Scripting Guy! I have a script that does certain management tasks based on the day of the week. I know how get the date in a script, but how can I tell whether it’s a Monday or a Tuesday or whatever? — CT, Tallahassee, FL Hey, CT. This is actually much easier then it…


Can I Change the Command Window Title When Running a Script?

Hey, Scripting Guy! When I run a batch file, I can use the Title command to change the caption of the command window. Can I change the caption of the command window from within a script?— AA, Yokohama, Japan Hey, AA. Well, yes, as long as you’re willing to open up a new command window….


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…


Why Doesn’t My Search Return All My User Accounts?

Hey, Scripting Guy! I’m trying to pull a list of all my users out of Active Directory. I’m using ADO to search for these users, but no matter what I do I can only get 1,000 user names, even though we probably have 10 times that many user accounts. What could I be doing wrong?—…


Can I Change the Current Directory When Running a Script?

Hey, Scripting Guy! Can I change the current directory while my script is running?— KO, Kalispell, MT Hey, KO. Yes, you can change the current directory while a script is running, provided you are running Windows Script Host 5.6, that is. To change the current directory, all you have to do is create an instance…


How Can I Determine Which Groups a User Belongs To?

Hey, Scripting Guy! In my logon script, how can I find out which Active Directory groups a user belongs to? — JB, Montpelier, VT Hey, JB. This is pretty easy to do in a logon script:On Error Resume Next Set objADSysInfo = CreateObject(“ADSystemInfo”) strUser = objADSysInfo.UserName Set objUser = GetObject(“LDAP://” & strUser) For Each strGroup…