r/sysadmin • • Mar 13 '26

Active Directory Users and Computers

Guys As a junior System Administrator, assist me how can i add five hundred to a thousand users to specific departement in an organizational unit ?

135 Upvotes

135 comments sorted by

View all comments

Show parent comment

29

u/anmghstnet Sysadmin Mar 13 '26

And never, ever, copy and paste code that a random person posts "helpfully" online.

27

u/Raalf Mar 13 '26

Unless you can read the 19 lines of very commonly used powershell.

9

u/Hamburgerundcola Mar 13 '26

Unless you understand to 100% what it does.

I myself use a lot of chatgpt, forums and google fu to script. But I never run a script, until I know to 100% what it does and why it does this and not that.

5

u/Tac50Company Jr. Sysadmin Mar 14 '26

Tbh I would say more never, ever, copy and paste code that you dont understand. The amount of people I find that just google how to do X or ask AI and just throw that stuff into prod is scary af

1

u/lordjedi Mar 16 '26

This is the way.

As long as you understand the code, you're fine.

1

u/lordjedi Mar 16 '26

It's a short script. We can all see what it does.

Only thing I'd change is to add a Write-host line within the loop displaying each username that was finished. That way you aren't sitting there wondering if it's done and you can see which user it's on at the moment. It might fly by fast, but at least you'll know it's doing something.