<< Back to Script Library
Get user’s SID
This script gets the user SID for the current username. If the same name exists in both the local computer and the domain, both SIDs will be returned.
The Script
Copy Script
Copied to clipboard
## win32_useraccount WMI class found to be very slow
## wmic useraccount where name='%username%' get sid
(New-Object System.Security.Principal.NTAccount("$env:userdomain\$env:username")).Translate([System.Security.Principal.SecurityIdentifier]).value