<!DOCTYPE html> <html> <head> </head> <body> <p><strong>Get the SID for a local user account.</strong><br />$username='julian'<br />$user = New-Object System.Security.Principal.NTAccount($username) <br />$sid = $user.Translate([System.Security.Principal.SecurityIdentifier]) <br />$sid.Value</p> <p><strong>Get the local username from a SID.</strong><br />$sid='S-1-5-21-5082059827-597078506-5194163137-1005'<br />$osid = New-Object System.Security.Principal.SecurityIdentifier($sid)<br />$user = $osid.Translate( [System.Security.Principal.NTAccount])<br />$user.Value</p> </body> </html>
Subscribe
0 Comments
Oldest