Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 74
  • Last Modified:

Scripting bulk user edit in AD

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

0
npc_caseym
Asked:
npc_caseym
1 Solution
 
becraigCommented:
Import-Csv C:\USER.CSV | %{
Set-ADUser -Identity $_.Name -replace @{extensionAttribute2="myValue";  Organization AD="myvalue2"}
}

Open in new window

0
 
SubsunCommented:
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

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now