Last active
May 8, 2016 10:05
-
-
Save potatoqualitee/2afbf12e90c0362a565a8553801a1d6c to your computer and use it in GitHub Desktop.
test if user exists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Local user | |
$account = New-Object System.Security.Principal.NTAccount('WorkstationX\Administrator') | |
$sid = $account.Translate([System.Security.Principal.SecurityIdentifier]) | |
# Domain User | |
$account = New-Object System.Security.Principal.NTAccount('base\ctrlb') | |
$sid = $account.Translate([System.Security.Principal.SecurityIdentifier]) | |
# This too, but dang is it slow | |
Get-CimInstance -ClassName Win32_UserAccount -Filter "Caption='base\\ctrlb'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment