D
D
DF2017-09-07 14:09:07
Active Directory
DF, 2017-09-07 14:09:07

How to edit an attribute in Active Directory for each user?

The task is to change the organization of all Active Directory users. There is an organization - "a" and an organization - "in". You need to change the name of the organization only for all users of the organization "a". Please share a script.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeniy Dikevich, 2017-09-08
@vstema

Get-ADUser -Filter * -Properties * | where Company -eq "a" | Set-ADUser -Company "b"

V
Vadim Choporov, 2017-09-08
@tolstyiii

Here's the simplest one:
$a = "Organization a" \\old
$b = "Organization b" \\to change
$Users = Get-ADUser -Filter *
foreach ($u in $Users){
if ($u =$a){
Set-ADUser $u -Replace @{company=$b}
}
}
Then wind up the conditions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question