Solved

BULK azure powershell upn change

Posted on 2015-01-14
3
207 Views
Last Modified: 2015-01-16
is there something wrong with my code

Import-CSV .\upntest.csv | % {

Set-MsolUserPrincipalName -UserPrincipalName $_.userprincipalname -NewUserPrincipalName $_.newuserprincipalname
0
Comment
Question by:Jorge Ocampo
  • 2
3 Comments
 
LVL 39

Expert Comment

by:Vasil Michev (MVP)
ID: 40549075
Missing "}" at the end? :)

Seems OK, but make sure that the fields in the CSV file are named appropriately (userprincipalname, newuserprincipalname)
0
 
LVL 2

Author Comment

by:Jorge Ocampo
ID: 40549394
would this work?

$N = 0
Import-CSV .\upn.csv | % {

Set-MsolUserPrincipalName -UserPrincipalName $_.userprincipalname -NewUserPrincipalName $_.newuserprincipalname


$N++

Write-host "Udpated $_.userprincipalname User Account(s)"

}
Write-host "Udpated $N User Account(s)"
0
 
LVL 39

Accepted Solution

by:
Vasil Michev (MVP) earned 500 total points
ID: 40549453
You dont need the $N thingy, it works just fine for me like this:

Import-Csv .\upntest.csv | % { Set-MsolUserPrincipalName -UserPrincipalName $_.UserPrincipalName -NewUserPrincipalName $_.NewUserPrincipalName}

Open in new window


Again, just make sure that the CVS fields are named appropriately. Do you get any particular error?
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you don't know how to downgrade, my instructions below should be helpful.
Read this checklist to learn more about the 15 things you should never include in an email signature.
Microsoft Office Picture Manager has a Picture Shortcuts pane that shows a list with the Recently Browsed folders. While creating my video Micro Tutorial here at Experts Exchange showing How to Install Microsoft Office Picture Manager in Office 2013…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now