Created
May 21, 2020 12:48
-
-
Save robderickson/ed9755e9c4148e6ff1871b158a07a86a to your computer and use it in GitHub Desktop.
Convert UserAccountControl attribute values to $true (enabled) or $false (disabled). See https://support.microsoft.com/en-us/help/305144/how-to-use-useraccountcontrol-to-manipulate-user-account-properties
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
# Convert UserAccountControl attribute values to $true (enabled) or $false (disable). See https://support.microsoft.com/en-us/help/305144/how-to-use-useraccountcontrol-to-manipulate-user-account-properties | |
function ConvertTo-ADUserEnabled { | |
[CmdletBinding()] | |
param( | |
[int]$UserAccountControl | |
) | |
PROCESS { | |
switch ($UserAccountControl) { | |
512 {$true} | |
514 {$false} | |
544 {$true} | |
546 {$false} | |
66048 {$true} | |
66050 {$false} | |
66082 {$false} | |
262656 {$true} | |
262658 {$false} | |
262690 {$false} | |
328194 {$false} | |
328226 {$false} | |
524802 {$false} | |
Default {$null} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment