Import-Module activedirectory
Import-Csv C:\usrs.csv | ForEach-Object {Set-ADUser -Identity $_.samAccountName -Replace @{Mobile=$_.MobilePhone}}
create usrs.csv with required contents as below and save in C:\
-----
samaccountname,MobilePhone
See all user attributes with below command . (some of which can be included for update. put ";" at the end of above command)
Get-ADUser asif.gohar -Properties *
Example. 2:
Import-Csv C:\usrs.csv | ForEach-Object {
Set-ADUser -Identity $_.samAccountName -Replace @{
telephoneNumber=$_.OfficePhone;HomePhone=$_.HomePhone;MobilePhone=$_.MobilePhone}
}
=====================
Other attributes:
Create UsersAll.csv as below and save on E:\ or other drive.
E:\UsersAll.CSV
samAccountName,Title,Department,Office
Import-Csv E:\UsersAll.csv | ForEach-Object {Set-ADUser -Identity $_.samAccountName -title $_.title -department $_.department -office $_.office}
=========================
Update Manager
Import-Csv E:\Managers.csv | ForEach-Object {Set-ADUser -Identity $_.samAccountName -Manager $_.Manager}
No comments:
Post a Comment