With the script in this post you’re able to set logon hours to a bunch of users. All you have to do is to setup logon hours for a “template” user and define this “template” user into the $template variable.
The other step is to define the $ou variable with the path to the OU. In my case this was ict-freak/Gebruikers.
The script will now read the default logon hours and will apply them to the users in the OU.
$template = "" # This is a user with the default logon hours $ou = "" # the full path to your ou "domainname/ouname1/ouname2" # Get the logonhours from the template user $template = Get-QADUser $template -IncludedProperties logonhours [array]$logonHours = $template.DirectoryEntry.logonHours # Get all users $users = Get-QADUser -OrganizationalUnit $ou # Loop through all the users foreach($user in $users){ Set-QADUser $user.Name -oa @{logonHours = $logonHours} }
I found this trick here: http://www.powergui.org/thread.jspa?threadID=7860