Scripting Blog [archived]

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

Hey, Scripting Guy! How Can I Add a User to Multiple Groups?

(image) Hey Scripting Guy! It seems that I can never find what I need anymore. I am looking for a Windows PowerShell script that will add a user to multiple groups. The user and the group are in the same organizational unit, and I do not want to have to run the same script multiple times to add a user to multiple groups. It should be easy to ...

Hey, Scripting Guy! How Do I Remove All Group Members in Active Directory?

(image) Hey Scripting Guy! I have several groups created in Active Directory whose membership has changed dramatically. Rather than go through a long list of users and try to manually clean up the list, I would like to just delete all the users from the group so that I can later add the newly approved members to the group. I have checked ...

Hey, Scripting Guy! How Can I Create Organizational Units with Windows PowerShell?

(Note  Today’s response is taken from Ed Wilson’s book, Windows PowerShell Step by Step, which is available on Microsoft Press.)(image) (image) Hey, Scripting Guy! At my company, we are often called upon to create objects in Active Directory. I do not mind using the Active Directory Users and Computers tool. It’s kind of...

Hey, Scripting Guy! How Can I Search Active Directory and Produce a Report?

(image) Hey, Scripting Guy! We are in the situation where we are closing a number of remote offices, and I need to quickly be able to generate a list of the computers that are contained in those remote offices. Basically I need to be able to generate a report that tells me the location and the name of the computer assets for each of a series...

Hey, Scripting Guy! How Can I Search Active Directory with Windows PowerShell to Return a List of Missing Groups?

(image) Hey, Scripting Guy! We created some groups that were used by our student interns. The student interns have now returned to college (yeah, it was a while ago). To be honest, I had actually forgotten about these groups, but the other day I was doing some work in Active Directory Users and Computers and I happened across one of these ...