- 02 Feb 2024
- 1 Minute to read
Set Active hours on Windows 10 and above devices
- Updated on 02 Feb 2024
- 1 Minute to read
Active Hours, a feature in Windows 10 and above, allows you to specify the times when you are most likely to use your computer. The main purpose of Active Hours is to prevent automatic reboots after a Windows Update. Setting the active hours would mean that the device could no longer install updates or schedule automatic restarts at the hours configured.
The following PowerShell script helps the IT Admins to configure active hours on managed Windows 10 and above devices.
Create a file on your desktop, for example, update_active_hours.ps1 and open it in a text editor like notepad++
Copy the contents below to the file or click here to download the file.
In the script add the start time and end time that can range from 0-24 (0-12 meaning 12:00 A.M. to 12:00 P.M. and 13-24 meaning 1:00 P.M. to 12:00 A.M.)
For example, if you wish to set active hours between 2 am and 8 pm, enter the start time and end time as:
$startHour = 2 $endHour = 20 $activeHours = "$startHour-$endHour" Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "ActiveHoursStart" -Value $startHour Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "ActiveHoursEnd" -Value $endHour Write-Host "Active Hours set from $startHour to $endHour."
Follow our guide to upload & publish the PowerShell script using Scalefusion Dashboard.
Active Hours only allows you to set a maximum time of 18 hours. Active Hours also does not allow you to set multiple times within a day or change weekend times.
Please note that to use the PowerShell scripts, the Scalefusion MDM Agent Application must be installed on the device(s). Please follow our guide to publish and install the Scalefusion MDM Agent Application.
The scripts and their contents are sourced from various albeit authenticated Microsoft sources and forums.
Please validate the scripts on a test machine before deploying them on all your managed devices.
Scalefusion has tested these scripts, however, Scalefusion will not be responsible for any loss of data or system malfunction that may arise due to the incorrect usage of these scripts.