Created
December 4, 2015 16:34
-
-
Save rufflabs/74426585526d5dce93c6 to your computer and use it in GitHub Desktop.
Sets logon hours for AD users to unrestricted.
This file contains hidden or 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
# Create a HashTable for logonHours, contents is a byte array. | |
# The code given by AD Admin Center's PowerShell History does not appear to work, but this does. | |
$logonHours = @{"logonHours" = [byte[]]$hours=@(255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255)} | |
Set-ADUser $User -Replace $logonHours |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found that when setting logon hours to unrestricted, the code given by the AD Administrative Center's PowerShell history function was not working, and gave the error that the property was already present. The above code worked instead.