Skip to content

Instantly share code, notes, and snippets.

@gravejester
Created August 23, 2016 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gravejester/b72cf245df3e6c4970435615ef0091e9 to your computer and use it in GitHub Desktop.
Save gravejester/b72cf245df3e6c4970435615ef0091e9 to your computer and use it in GitHub Desktop.
function ConvertTo-ImmutableId {
[CmdletBinding()]
param (
[Parameter(Position = 0, ValuefromPipeline = $true, ValueFromPipelinebyPropertyName = $true)]
[Guid]$ObjectGUID
)
try {
$byteArray = $ObjectGUID.ToByteArray()
$immutableId = [Convert]::ToBase64String($byteArray)
Write-Output $immutableId
}
catch {
Write-Warning $_.Exception.Message
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment