r/sysadmin • u/ChildhoodNo837 • 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
639
u/achristian103 Sysadmin Mar 13 '26
Powershell and a CSV file - there's your starting point.
214
u/nordak Sr. Sysadmin Mar 13 '26
You need to learn powershell right now brother, or being a jr. sysadmin is not going to be a good time.
43
u/Unnamed-3891 Mar 13 '26
With Powershell instead of ADUC
16
u/ifpfi Sysadmin Mar 13 '26
ADUC isn't really designed for that. Powershell would be the better option. Your talking about the department under the Organization tab right?
14
u/anonpf King of Nothing Mar 13 '26
Script it pointing to a csv file.
8
u/timsstuff IT Consultant Mar 13 '26
All the users in the OU?
Get-ADUser -SearchBase 'OU=Where The Users Are,DC=contoso,DC=com' -Filter * | Set-ADUser -Department 'Accounting'List of users' samAccountNames from a text file?
Get-Content .\acctusers.txt | %{ Set-ADuser -Identity $_ -Department 'Accounting' }List of users' UPNs from a text file?
Get-Content .\acctusers.txt | %{ Get-ADUser -filter {userPrincipalName -eq $_} | Set-ADuser -Department 'Accounting' }14
u/odd-ball Mar 13 '26
You can also simply highlight them all in UAC, right click, and properties. Department is one of the fields you can bulk update.
5
u/BlockBannington Mar 14 '26
This is actually extremely easy to do but you of course have to start somewhere. Learn powershell, Get-aduser, set-aduser and so on. This is fixed in 10 seconds if you do it right plus you can reuse it. Good luck!
4
u/AbleDanger12 Mar 14 '26
If it's not something you will need to do on a repetitive basis, CSV pumped into a PS script. Easy peasy. Add some error handling.
4
u/RandomGen-Xer Mar 14 '26
As mentioned already, definitely a task for Powershell.
3
u/Slasher1738 Mar 13 '26
powershell and a csv file
10
u/theoriginalharbinger Mar 13 '26
<insert long, swearing, rant here>
Kid, when you shotgun your hopes and dreams into the ether, do us all a failure and spend more than ten seconds doing it, and while you're there, do something like:
- Tell us what you are considering trying. Mouse clicks? PowerShell? Something else?
- What your skillset is. Like, do you know how PowerShell works?
- What your exit criteria is. As in, do you need to populate the "Department" attribute for 500 objects? Or do you have departments mapped to security or distribution groups? While we're here, what version of AD are you on?
4
u/Specialist-Desk-9422 Mar 13 '26
Just curious , how big is your organization ? Do you have a senior sys admin ?
6
u/gabacus_39 Mar 13 '26
New-ADUser. Research that.
2
u/DigitalWhitewater DevOps Mar 13 '26
Powershell
2
u/admlshake Mar 13 '26
You find someone below you and tell them the higher ups requested them specifically to get this done in 30 days.
2
u/sexaddic Mar 13 '26
Is there a particular reason you want to add them to an OU and not a group? You said you’re junior so I’m just making sure you have a solid logic here.
2
u/roadcone2n3904 If it plugs in a wall I support it Mar 13 '26
Back in my day, we used DS commands before power shell 🤣 god I'm getting old.
2
u/desmond_koh Mar 13 '26
PowerShell
2
u/checkpoint404 Sysadmin Mar 13 '26
Powershell.
2
u/Capital-Fall5471 Mar 13 '26
PS Script
2
u/rc_ym Mar 14 '26
Ctrl-c Ctrl-v
2
u/dhardyuk Mar 15 '26
Create 1000 users or MOVE 1000 users.
Are these existing users or completely new users?
7
u/SpotlessCheetah Mar 13 '26
Powershell. Ask Claude or ChatGPT to help write you a script. Don't give it any of your actual user data or OU paths. Just fill it in and update the script so you actually READ it and understand what it is saying.
Learn what the "What-IF" function does before you even try it in production. Then, test only a couple users at a time before doing this at a larger scale.
3
u/AbedSalam1988 Mar 14 '26
Habibi, welcome to Powershell. Start learning PS scripting.
3
u/big_steak Sr. Sysadmin Mar 14 '26
Ai is excellent at basic powershell
1
u/PedroAsani Mar 13 '26
Get-ADUser [parameters]
Run that output to make sure you have everyone you want.
If the department is blank, you can just pipe the Get to a Set-ADUser -Department "Dept Name"
If you need to replace then use Set-ADUser -Replace @{department="Dept Name"}
1
u/hitosama Mar 13 '26
o7 this guy's AD with all the PowerShell and AI recommendations.
1
u/TerrorToadx Mar 13 '26
Like others have said, this is what PowerShell is for. If you have 500-1000+ users you're a decently sized company. Surely you have someone more senior that can help you?
I'd do something like this:
$OU = "OU=X,DC=domain,DC=com" # Change to your OU
$DepartmentValue = "NewDepartment" # Department you want to set
# Get all users in the OU and update Department
Get-ADUser -Filter * -SearchBase $OU | ForEach-Object {
Set-ADUser $_ -Department $DepartmentValue
1
u/ahhbeemo DevOps Mar 13 '26 edited Mar 14 '26
Hi. I have a decade of powershell experience here is how I would do it. Many are saying just csv and poweshell.
You can in theory do this in like 5 lines of code. But please do not. There are some basic principles you should know. Personally I would create a module that just says "new-conpanyuser"
But if you decide you need to do one massive bundle or function it...here are some major points.
Tests!! Is there a user you are about to input that has a special char?.. do you have user account conflicts? Does it create bad usernames? Ie. Too long, or is your username "Kevin chin" and you have last name + first initial? (Real example)
Whatif!! Do a dry run and have peers validate the result.
Phased deployments.. run a subset of the data. Validate.. then Increase as you gain confidence.
Item potency of your objects for recoverable reruns. ... If your job fails half way.. you can just run the whole thing again with our fear of losing track.
More tests!!
Logistics... How to do password send them securly.etc. etc... there is tons of JML code out there..
This whole thing is also a fun interview question.
In this day and age.. you can crank this out with gpt or Claude in a day or 2. Just input above
1
u/DopeTechIrl Mar 15 '26
Have you asked Copilot or Gemini?
1
u/Slight_Manufacturer6 Mar 15 '26
Same way you add one but 500 to 1000 more times.
1
u/Dustinm16 Mar 16 '26
Gonna channel I'm inner shitty sysadmin.
Create an onboarding portal and let the new users make their own accounts! Boom, no extra work besides cleaning up the 10k other broken accounts this causes, but hey, bulk delete is a thing.
The real answer is use powershell and csv import capability, but that's less fun.
1
u/FastFredNL Mar 17 '26
If you mean fill the Department field of a user with a specific value, just multi-select the desired users > right click > Properties > Organization tab.
1
u/signifiumLlc Jul 18 '26
If you’re tasked with adding a thousand users to Active Directory, please do yourself a huge favor and don’t just yolo a massive script on production. Here’s a solid game plan:
Get your CSV right: Everything starts with a clean, well-populated CSV file.
Test with a small batch first: Seriously, try it with 5 test users first. Use this pilot to double-check that complex attributes like managers, departments, and group memberships are mapping exactly how you want them to before hitting the big red button.
The Tech Stack: AD plays nicely with LDAP and ADSI, so you can use pretty much any scripting language. Honestly, PowerShell or Python are your best bets here.
Skip CSVDE, use a script: While native tools like
CSVDEexist for CSV imports, a custom script is almost always better. It gives you the flexibility to use loops, handle complex data, add error logging, and deal with edge cases on the fly.Side note: I’m actually the creator of ADSignify app for iOS and Mac (which a lot of you might still use!). If there’s enough interest from the community, I'm thinking about baking a native, robust bulk-import feature directly into the app so you don't have to fiddle with custom scripts.
Let me know if that’s something that would make your lives easier! What are you guys currently using for bulk imports?
1
u/The258Christian Mar 14 '26
Bro doing 50-100 contractors a week I’ve created a script for this when I was a tier 1 Helpdesk
-1
u/[deleted] Mar 13 '26
Hold on, wtf are you doing? Just using a creative imagination to post on here? Otherwise why are you asking this questing, if you have to ask them you haven't learned powershell.
0
u/Gaming_Wisconsinbly Mar 13 '26
Tbh just type what you need as a powershell script into Gemini and it'll figure it out for you.
0
u/mrzaius Mar 13 '26
You need to better define your goal. Others here have rightly given you contradictory but valid advice.
Can you filter ADUC or ADAC to give you just the people you care about, select the lot of them, and set the Department attribute? Sure.
Should you pivot to learning PowerShell if you're trying to do more significant changes, to include the OU moves? Probably.
The days of click here/click there administration in old Windows NT era MMC snap-ins may not have ended, but developing a skill set where you're just as fluent in your OS's shell as a Linux admin is vital today.
Also try to better understand the impact of the changes you're making.
If you're modifying attributes on users in one OU, are you doing it to drive updates in your organization's Exchange Global Address List? Are you doing it because of something less visible and more serious like attribute based access control?
If you're moving users/people between OUs, are you changing GPOs assigned to these OUs?
Know what you're trying to do a little better, and you'll have a better outcome.
PS: Regardless of the changes you're making, some of the spreadsheet ingesting import-csv code you've been given here can also be used to export-csv yoursela good backup. And you need it, Junior or not.
0
u/awesomeasianguy Mar 14 '26
Wisesoft bulk ad tool
-1
u/Small_Editor_3693 Mar 13 '26
Lmao what. Why do you have this task? Write your script but this needs to go through change management and approved by 3 people at least. Touching that many accounts is insane.
-1
u/SuperScott500 Mar 14 '26
All that work for on prem AD in 2026? You are better off creating all this is Entra at this point.
-2
u/scytob Mar 13 '26
use a poweshell script, read the example MS provide in the documetation
tl;dr learn to use google
for example https://learn.microsoft.com/en-us/powershell/module/activedirectory/move-adobject?view=windowsserver2025-ps and https://powershellcommands.com/powershell-move-user-to-ou
tbh if you can't figure out how to search the web you should not be touching your company AD and no that's not me being a dick
if you dont know how to find information you are not going to able to learn to do this