Showing posts with label Migration. Show all posts
Showing posts with label Migration. Show all posts

Wednesday, March 22, 2017

Upload AD Photos to Office 365

So, an interesting issue I came across the other day. My customer wanted to copy all photos from AD to Office 365. Since I hate doing manual labor, or leaving it to each user to re-upload their pictures, I came up with this simple script.

All you have to do is enter your Office 365 admin credentials into the script, and run it from a Domain Admin account within your environment.

# Set Credentials
$Username = "admin@tenant.onmicrosoft.com"
$Password = ConvertTo-SecureString 'MyPassword' -AsPlainText -Force
$UserCredential = New-Object System.Management.Automation.PSCredential $Username, $Password

#Connect to O365 Exchange Online
$ConnectionURI = "https://outlook.office365.com/powershell-liveid/?proxymethod=rps"
$EXSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $ConnectionURI -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $EXSession -AllowClobber

#Get Mailboxes
$Mailboxes = (Get-MailBox -ResultSize Unlimited |?{$_.IsDirSynced -eq "True"})

foreach($Mailbox in $Mailboxes){
  $ADPhoto = $Null
  $ADPhoto = (Get-AdUser -Identity $Mailbox.Alias -Properties thumbnailPhoto).thumbnailPhoto
  If($ADPhoto.Length -ne 0){
    Write-Host -ForegroundColor Green "Uploading Picture for $($Mailbox.Name)"
    Set-UserPhoto -Identity $Mailbox.Alias -PictureData ([byte[]]$ADPhoto) -Confirm:$False
  }
}

Remove-PSSession $EXSession

Please let me know if you find a better way of doing this.

P.S. don't worry about the errors, as I have not put any error checking into this script.

Wednesday, August 3, 2016

Moving from On-Premises to Skype for Business Online

This is a gotcha which took me two days to figure out. I was moving a customer from a broken Skype for Business on-premises to O365 Skype for Business Online.

Why go through the pain of hybrid, if the users never used the system in the first place. What I found is there is a lack of documentation on what are the steps to move in a big-bang scenario. So here goes....



  1. Remove all users from your on-prem deployment
  2. Make sure the users are not licensed for Skype for Business Online yet (if they are, remove it)
  3. Make sure that "ALL" msRTCSIP-* attributes are null, and have propagated to all your DCs
  4. Do another directory sync to O365 using your AADConnect server
  5. Assign License on O365
  6. Test User Connectivity
What got me here was step "3" .. All attributes were Null except for msRTCSIP-DeploymentLocator which was set to "SRV:" ... in a normal deployment this would be good because it means automatically detect the server. In O365 world, this means the user is On-Prem and don't enable them for Skype for Busienss.

Powershell Command to remove it..

 
Get-ADUser -SearchBase "OU=Users,DC=contoso,DC=local" -Filter * |Set-ADUser -Clear "msRTCSIP-DeploymentLocator"