Created
January 18, 2016 05:25
-
-
Save chrisbrownie/d973865e1982f01fe393 to your computer and use it in GitHub Desktop.
Sets ImmutableIDs for all Office 365 users based on AD...without needing to touch anything.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-ImmutableId ($a) { | |
[System.Convert]::ToBase64String(([guid](Get-ADUser $a -Properties ObjectGuid).ObjectGuid).ToByteArray()) | |
} | |
## | |
## WARNING: This script does not health check anything at all. | |
## If you run it without knowing what it does, you | |
## will probably break the internet, and not in the good way. | |
## | |
Get-MsolUser -All | | |
Where {$_.UserPrincipalName -ilike "*@contoso.com" -and $_.ImmutableId -eq $null} | | |
% { $_ | Set-MsolUser -ImmutableId (Get-ImmutableId $b) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script doesn't even work, where does $b come from?