Scripting Blog [archived]

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

How Can I Add a Domain User to a Local Administrators Group?

(image) Hey, Scripting Guy! How can I add a domain user to the local Administrators group in a computer?-- MB(image) (image) (image) Hey, MB. One reason we started doing this column was because we wanted to know more about what system administrators do (and script) on a regular basis. As it is, sitting here in our luxurious penthouse ...

How Can I Get a List of Exchange Servers Assigned to My Users?

(image) Hey, Scripting Guy! How do I get a list of the Exchange servers (msExchHomeServerName) assigned to the users in an OU?-- BG(image) (image) (image) Hey, BG. As you probably already figured out, you have two issues: you need to get a list of all the users in an OU, and then you need to figure out which Exchange server they’ve been ...

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

(image) 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(image) (image) (image) 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 Can I Enumerate All the Objects in an Active Directory OU?

(image) Hey, Scripting Guy! How can I enumerate all the objects in an Active Directory OU?-- RB(image) (image) (image) 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 you ...

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

(image) 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?-- MC, Athens, GA(image) (image) (image) Hey, MC. Boy, ...