Solved

BULK azure powershell upn change

Posted on 2015-01-14
3
191 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 38

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 38

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Learn more about how the humble email signature can be used as more than just an electronic business card. When used correctly, a signature can easily be tailored for different purposes by different departments within an organization.
"Migrate" an SMTP relay receive connector to a new server using info from an old server.
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…
This Experts Exchange lesson shows how to use VBA to loop through rows in Excel.  In order to sort, filter, and use database features, there needs to be a value in each column for every row. When data arrives with values missing, code to copy values…

757 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

20 Experts available now in Live!

Get 1:1 Help Now