Active Directory - Bulk Company Update
I was wondering if there is a way to update the 'Company' field for a large group of users within Active Directory? I would like to match all users with a company ending in a certain string.
It would take way too long to change this for each user individually.
dsquery user -name * -limit 0 | dsmod user -company "%COMPANY%"
Adjust the dsquery
to target specific users as required.
Edit: To match on a specific [sub-]string
dsquery * -filter "&((objectCategory=Person)(objectClass=User)(company=*OLDCOMPANY))" -limit 0 | dsmod user -company "%NEWCOMPANY%"
Adjust the *OLDCOMPANY
regex to suit your needs.