Export and update AD

$users = Import-Csv -Path C:\uu\all.csv            


foreach ($user in $users) {                    

Get-ADUser -Filter "SamAccountName -eq '$($user.samaccountname)'" -Properties * -SearchBase "DC=domain,DC=com" |            

 Set-ADUser -surname $($user.sn) -givenname $($user.givenname) -displayname $($user.displayname) -officephone $($user.TelephoneNumber) -Mobilephone $($user.mobile) -StreetAddress $($user.streetaddress) -homephone $($user.homephone) -company $($user.company) -department $($user.department) -office $($user.physicaldeliveryofficename) -fax $($user.facsimiletelephonenumber)}


csvde -m -f AccountName_mailboxes.txt -r "(&(objectClass

=*)(mail=*))" -l objectClass,displayName,memberOf,proxyAddresses,legacyExchangeD

N,title,telephoneNumber,facsimileTelephoneNumber,mobile,homephone,givenName,comp

any,userPrincipalName,co,c,physicalDeliveryOfficeName,postalCode,sn,st,streetAdd

ress,title,wWWHomePage,description,l,initials,info,sAMAccountName


你可能感兴趣的:(update,domain,department,Company)