Powershell fun time

Langly

Supreme [H]ardness
Joined
Dec 23, 2002
Messages
4,694
So I was asked by a coworker today to do something that is easy to do... but manually doing it would be boring and tedious.

Basically I am creating a new security group in AD. I have 800 AD users I need to put into this group though. I first started by exporting all of the usernames from two separate distro groups via powershell and combining the list into one giant csv file.

So far my google foo has failed as everyone is using different CMD-Lets that I don't want to play with right now unless absolutely necessary. I'm hoping this is just a simple thing but does anyone have an easy way to import a .csv or .txt file of users into a security group in AD? So far everything I've looked at hasn't worked (because they use cmd-lets or crazy 80 lines of scripting that is more confusing to me than helpful)

Alternatively, does anyone have any tips/how-to's or good basic powershell guides they would want to share? Being a new network admin I know I've got a lot to learn and powershell is just another brick in the road for me and I'm sure a few others of us newcomers to the field.

Cliffs:
Powershell thread
Anyone have good guides for a new powershell user?
 
My god that's a lot of code to just add a user! If you use the Quest cmdlets, you can create a user and mailbox, set groups, etc etc with much much less and seven simpler code.

I'm gonna just go with the Quest cmdlets. I wanted to avoid that but after that wall of code just to add a bunch of guys to a group. I'll just save time with it.

Anyone else got some good tips for powershell? Lets just change this thread around to go that route.
 
Sometimes, using powershell by itself is overkill.

If you are just using a CSV as input to add users to a group, and that only, using powershell to read the csv and execute a "net group <groupname> /add <username> /domain" command at the command line is really easy.
 
Back
Top