Scripting bulk user edit in AD

npc_caseym
npc_caseym used Ask the Experts™
on
I have a Powershell script to modify the extensionAttribute2 attribute for a list of AD users (from a CSV).  How would I add a field to it?  If I wanted to update the Organization AD field with data in the second column of the CSV...is that possible?

Thanks,
Casey

Here's my current script:
Import-Csv C:\USER.CSV | %{
Set-ADUser -Identity $_.Name -replace @{extensionAttribute2="myValue"}
}

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Import-Csv C:\USER.CSV | %{
Set-ADUser -Identity $_.Name -replace @{extensionAttribute2="myValue";  Organization AD="myvalue2"}
}

Open in new window

IT Infrastructure Architect
Commented:
Try..
Import-Csv C:\USER.CSV | %{
Set-ADUser -Identity $_.Name -replace @{extensionAttribute2="myValue"} -Organization $_.Organization
}

Open in new window


USER.CSV sample shown below..
Name,Organization
UserA,Sales
UserB,IT
UserC,Accounting

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial