mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 15:19:58 -05:00
16 lines
403 B
PowerShell
16 lines
403 B
PowerShell
function Get-IcingaUsernameFromSID()
|
|
{
|
|
param (
|
|
[string]$SID
|
|
);
|
|
|
|
if ([string]::IsNullOrEmpty($SID)) {
|
|
Write-IcingaConsoleError 'You have to specify a SID';
|
|
return $null;
|
|
}
|
|
|
|
$UserData = New-Object System.Security.Principal.SecurityIdentifier $SID;
|
|
$UserObject = $UserData.Translate([System.Security.Principal.NTAccount]);
|
|
|
|
return $UserObject.Value;
|
|
}
|