Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to Change / Add AD attributes

Status
Not open for further replies.

RCorrigan

MIS
Feb 24, 2004
2,872
MT
OK ... so this doing my head in ... probably have stared at it too much

Trying to Add / Change a couple of AD attributes through a PS Script to save me having to individually edit numerous users
Have Csv with following columns : User Company Department Manager

Script is as follows :
Code:
Import-Csv "C:\temp\update.csv" 

foreach ($user in $users) {
Get-ADUser -Filter "SamAccountName -eq '$($user.User)'" -Properties *  |Set-ADUser -department $($user.department) -title $($user.title) -company $($user.Company)
}

but all it seems to do is list the users and not change the attributes :(

Any pointers gratefully accepted

Cheers


<Do I need A Signature or will an X do?>
 
Before anything else, should

[tt]Import-Csv "C:\temp\update.csv"[/tt]

read

[tt]$Users = Import-Csv "C:\temp\update.csv"[/tt]

?
 
Sorry --- yes it does .... missed I'd not got that bit in the copy & paste for the code snippet !!!!!

<Do I need A Signature or will an X do?>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top