by nmuzic at 2013-01-30 06:19:39
Could someone help me with updating users info in Active directory?by Tadziz at 2013-01-30 07:47:50
I’m trying with following code:
[code2=powershell]Import-Module ActiveDirectory
$users = Import-Csv -Path c:\ADMIN\Users.csv -delimiter ";"
foreach ($user in $users) {
Set-ADUser -Identity $($user.SamAccountName) -Replace @{telephoneNumber = $($user.telephoneNumber); pager = $($user.Pager); ipPhone = $($user.ipPhone); facsimileTelephoneNumber = $($user.facsimileTelephoneNumber); mobile = $($user.mobile); physicalDeliveryOfficeName = $($user.physicalDeliveryOfficeName); department = $($user.department); description = $($user.description)}
}[/code2]
csv file contains user data in the format:
samAccountName;givenName;sn;telephoneNumber;Pager;ipPhone;facsimileTelephoneNumber;mobile;physicalDeliveryOfficeName;department;description
jondoe;jon;doe;+xxxxxxxx;xxxx;+xxxxxxxxxxx;+xxxxxxxxxxx;;place;IT department;IT officer
I have problem with users that have an empty value for example "mobile" and doesn’t update any value for that user.
Regards,
nmuzic
hi,
I’m new in powershell but maybe this link can help you
http://blogs.technet.com/b/heyscripting … ctory.aspx
if you need to update users from your computer i would open new-pssesion and when update user using ad cmdlet