ps/Modules/Alkami.PowerShell.Common/Public/Get-UsernameFromSid.ps1

22 lines
487 B
PowerShell
Raw Normal View History

2023-05-30 22:51:22 -07:00
function Get-UsernameFromSid {
<#
.SYNOPSIS
Converts a SID to a Username
.PARAMETER SecurityIdentifier
Identifier to use to find a username
#>
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[Alias("SID")]
[string]$SecurityIdentifier
)
$objSID = New-Object System.Security.Principal.SecurityIdentifier($SecurityIdentifier)
$objUser = $objSID.Translate([System.Security.Principal.NTAccount])
return $objUser.Value
}