July 2018
Beginner
552 pages
13h 18m
English
The following example again shows the huge benefits of PowerShell allowing you to simply use .NET objects and methods. In many cases, you may want to search for the SIDs for specific users in your domain. This can be achieved by using the NTAccount object, as follows:
$domain = 'exampleDomain'$username = 'David'$sid = (New-Object Security.Principal.NTAccount($domain, $username)).Translate([Security.Principal.SecurityIdentifier]).Value$sid
$username = 'Administrator'$sid = (New-Object Security.Principal.NTAccount($env:computername, $username)).Translate([Security.Principal.SecurityIdentifier]).Value$sid
Read now
Unlock full access