- Import-Module ActiveDirectory
- $USERS = Import-CSV c:\users.csv
- $USERS | foreach {
- $empid=$_.employeeid
- $company=$_.company
- $title=$_.title
- $department=$_.department
- $Division=$_.division
- $pobox=$_.pobox
- $city=$_.city
- Set-ADUSer -Identity $_.samaccountname -Replace @{employeeID=$empid; company=$company; title=$title; department=$department; division=$division; postofficebox=$pobox; l=$City}
- }
Import-Module ActiveDirectory
$USERS = Import-CSV c:\users.csv
$empid=$USERS.employeeid
$company=$USERS.company
$title=$USERS.title
$department=$USERS.department
$Division=$USERS.division
$pobox=$USERS.pobox
$city=$USERS.city
$acc=$USERS.samaccountname
ForEach ($user in $USERS) {
Get-ADUser -Filter "samaccountname -eq '$Acc'" | Foreach {
Set-ADUser $ -Replace @{title = $title}
Set-ADUser $ -Replace @{company = $company}
Set-ADUser $ -Replace @{department = $department}
Set-ADUser $ -Add @{division = $division}
Set-ADUser $ -Replace @{postOfficeBox = $pobox}
Set-ADUser $ -Replace @{l = $city}
Set-ADUser $_ -Replace @{employeeid = $empid}
}
}

 
No comments:
Post a Comment