PowerShell, is it possible to translate the SID to ntaccount if you are not part of the domain?

I have this powershell code.

$securityidentifier = new-object security.principal.securityidentifier $sid
$user = ( $securityidentifier.translate( [security.principal.ntaccount] ) )

This code only works on a computer that is in the same domain as the user whose SID I would like to transfer to ntaccount.

Can I transfer the SID to ntaccount if you are not part of a domain, but you have a domain username and password for this domain?

Still the same error.

Exception calling "Translate" with "1" argument(s): "Some or all identity references could not be translated." At C:\...\test.ps1:7 char:40 + $user = ( $securityidentifier.translate <<<< ( [security.principal.ntaccount] ) ) + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException

+3
source share
2 answers

Since you are not in a domain, your machine does not know who (which domain controller) should ask to allow this SID. There seems to be no server parameter for the Translatename method.

WinApi, : LookupAccountSid API ( lpSystemName).

0

, , ? SID. , .

0

Source: https://habr.com/ru/post/1768103/


All Articles