?
Solved

BULK azure powershell upn change

Posted on 2015-01-14
3
Medium Priority
?
442 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 42

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 42

Accepted Solution

by:
Vasil Michev (MVP) earned 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Enabling the Skype for Business Meeting Scheduler in Hybrid OWA
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
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 …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

762 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