import-csv users.csv | %{set-aduser $_.SamAccountName -SamAccountName $_.NewSamAccountName -UserPrincipalName $_.NewUPN}
Test with a small number of items first, then you can run in bulk against the bigger list
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
import-csv users.csv | %{set-aduser $_.SamAccountName -SamAccountName $_.NewSamAccountName -UserPrincipalName $_.NewUPN}
Test with a small number of items first, then you can run in bulk against the bigger list
Hi,
What is your csv file like? You can use Set-ADUser
to set the attributes of an AD user.
Get-ADUser -Filter {SamAccountName -eq "USA.A1234"} | Set-ADUser -SamAccountName "A1234" -UserPrincipalName "A1234@domain"
For more details you can refer to this link
https://learn.microsoft.com/en-us/powershell/module/addsadministration/set-aduser?view=win10-ps
Best Regards,
Ian
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Hello,
thank you for the response, my csv file looks like:
SamAccountName,NewSamAccountName,NewUPN
I have 300 users to process
Thank you
Thank you very much, I just tested with few accounts and it works.