Solved

BULK azure powershell upn change

Posted on 2015-01-14
3
269 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 40

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 40

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Outlook 13 41
List all Printers with anmes and Ip address 3 28
not able to add Exchange account to android phone 3 28
..ignore the Question 1 7
A brief introduction to what I consider to be the best editor for PowerShell.
The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
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 video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

856 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