Last active
April 21, 2023 23:11
-
-
Save nicolonsky/aecd9f0fa689cebf49b623f209f21f38 to your computer and use it in GitHub Desktop.
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
$username = "clientadmin" | |
try { | |
$user = Get-LocalUser -Name $username -ErrorAction Stop | |
if ($user.Enabled) { | |
Write-Output ("User {0} present and enabled" -f $username) | |
exit 0 | |
} | |
else { | |
Write-Output ("User {0} present but NOT enabled" -f $username) | |
Exit 1 | |
} | |
} | |
catch { | |
Write-Output ("User {0} not found" -f $username) | |
Exit 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment