Jump to content

Recommended Posts

Posted

Good afternoon

 

I'm going to try and explain this as best I can but apologies if it gets a little complicated:

 

When creating\managing users in AD we have the choice of giving them the suffix of @schoolname.county.sch.uk or @nameoftrust.org.uk

 

What I would like to achieve is being able to change a user from @schoolname...to @nameoftrust... and have Outlook auto discover as it does normally. Currently this is not happening.

 

Now for some reason we have been left with multiple ways of creating users, either using Exchange to setup an Office 365 mailbox which then creates the user in AD simultaneously or creating the user in AD directly which in turn syncs to Office 365. Any advice on best practice here is also welcome but primarily I want to achieve that change of domain above and I just don't know what I'm doing wrong.

 

Thank you

Posted

Good evening

 

Thanks for the advice, I think because I am able to change the username in AD to either domain and I know AD syncs to Office 365 I was expecting Office 365 to reflect the change at next sync but this doesn't occur.

 

If I look in Office 365 I can change the user e-mail to either domain but have not tried this simple approach yet as Office 365 tells me that we are AD synced and some changes can only be made in AD.

 

Thank you

Posted

AD will sync with Office 365 but will use other fields other than the domain.

 

I would ensure the UPN is set correctly, the mail field is set correctly and force a sync

Posted

If memory serves you can't just change the UPN of the account and have it replicate to O365. We did this when we first started and had to use Powershell scripts to update the O365 field to match the new UPN

 

When i'm at my desk tomorrow i'll dig my script out see if it is of any use

Posted

This is the snippet of code that re-arranges our tennant UPNs

 

Hopefully it is useful. Once you change the UPN on the tennant that will be the username that they will need to log in with.

 

Probably best to pop the code in to the powershell ISE shows the comments/ variables a bit better :)

HTH

 

<# Module Imports #>

Import-Module MSOnlineImport-Module ActiveDirectory

<# Username and Password Setup for MSOL connection #>

$Username = "" 

<# Will be something like [email protected] #>

$EncryptedPassword = "" | ConvertTo-SecureString -AsPlainText -Force

$MSOLCred = New-Object System.Management.Automation.PSCredential($Username,$EncryptedPassword)

<# Perform MSOL Connection #>

Write-Host "Connecting to Microsoft online using:" $Username

Connect-MsolService -Credential $MSOLCred

<# Update all MSOL users with proper UPN (except ADFS Account) #>

Write-Host "Updating Users Office 365 UPN to end @"

Get-MsolUser -all | Where {

   <# This bit gets all the users on your tennant that are not the Global admin on your tennant and dont already end in the new UPN #> 
  -Not $_.UserPrincipalName.ToLower().StartsWith(“@”) -and -not $_.UserPrincipalName.ToLower().EndsWith("")  
      } | ForEach {    
   <# This sets all the accounts found above to the new UPN #>   
Set-MsolUserPrincipalName -ObjectId $_.ObjectId -NewUserPrincipalName ($_.UserPrincipalName.Split(“@”)[0] + “@”)     
  }
Write-Host "Process Complete"

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...