Skip to content

Instantly share code, notes, and snippets.

@maximd
maximd / Get-UidFromSid.ps1
Created June 30, 2022 20:33 — forked from rmbolger/Get-UidFromSid.ps1
Functions for converting a SID to a UID for use with RFC2307 attributes in Active Directory
function Get-UidFromSid
{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true,Position=0,ValueFromPipeline,ValueFromPipelineByPropertyName)]
[System.Security.Principal.SecurityIdentifier]$sid
)
Process {
# convert sid to byte array