Added Files

This commit is contained in:
DistractADD
2021-07-06 13:16:46 +10:00
parent f2475a3bdd
commit cfddd4fad2
393 changed files with 65842 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
# Bulk update Online User UPNs
#
# What domain are we replacing?
$oldDomain = ''
# What are we replacing it with?
$newDomain = ''
# Import the MSOnline module and connect
Import-Module MSOnline
Connect-MsolService
# Get all users using that domain as their UPN
$users = Get-MsolUser -All | Where-Object {$_.UserPrincipalName -match $oldDomain}
# Run through the users replacing their UPN and keeping us updated on what's going on
foreach ($user in $users) {
$newUPN = $user.UserPrincipalName.Split('@')[0] + '@' + $newDomain
Write-Output -InputObject ('Setting UPN for user ' + $user.UserPrincipalName + ' to ' + $newUPN)
Set-MsolUserPrincipalName -UserPrincipalName $user.UserPrincipalName -NewUserPrincipalName $newUPN
}