
Getting the SID of the current user
2014, Apr 11
Getting the SID of the current user, using PowerShell, is remarkably simple. This one-liner retrieves the SID of the current logged on user.
Get-WmiObject win32_useraccount -Filter "name='$env:username' and domain='$env:userdomain'"