Advertisement
tankcr

Migrate O365

Apr 28th, 2015
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. "C:\Program Files\Windows Azure Directory Sync\DirSync\DirSyncConfigShell.psc1"
  2. Import-Module msonline
  3. $cred = Get-Credential
  4. Connect-MsolService -cred $cred
  5.  
  6. $msolusers = Get-MsolUser -Verbose
  7. $OLcurrentuser = $msolusers|where-object{$_.UserPrincipalName -ilike "*Burton*" -and $_.UserPrincipalName -notlike "*test*"}
  8. #$OLcurrentuser.ObjectId
  9. $FN = $OLcurrentuser.FirstName
  10. $LN = $OLcurrentuser.LastName
  11.  
  12. $aduser = Get-ADUser -filter *|where-object{$_.GivenName -eq $FN -and $_.Surname -eq $LN -and $_.UserPrincipalName -notlike "*test*"}
  13. $adguid = $aduser.ObjectGUID
  14. #$OLcurrentuser.ObjectId = $adguid
  15. $immutableID = [System.Convert]::ToBase64String($adguid.tobytearray())
  16. Set-MSOLuser -UserPrincipalName $OLcurrentuser.UserPrincipalName -ImmutableID $immutableID
  17. #Set-MSOLuser -UserPrincipalName $OLcurrentuser.UserPrincipalName -ImmutableID $adguid
  18. $OLcurrentuser.ImmutableId
  19.  
  20. Start-OnlineCoexistenceSync -Fullsync
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement