doc/dsc/modules/Awake.md
Manages configuration for the Awake utility, which keeps your computer awake without changing power settings.
The Awake module configures PowerToys Awake, a utility that prevents your
computer from going to sleep or turning off the display. This is useful
during installations, presentations, or any scenario where you need to
temporarily override power settings without permanently changing them.
Awake supports multiple modes including indefinite keep-awake, timed intervals, and scheduled expiration. The display can be kept on or allowed to turn off independently of the system sleep state.
The Awake module supports the following configurable properties:
Controls whether the display remains on while Awake is active.
Type: boolean
Default: true
Description: When true, prevents the display from turning off. When
false, only prevents system sleep while allowing the display to turn off
according to power settings.
Specifies the Awake operating mode.
Type: integer
Allowed values:
0 - Off (Awake is disabled).1 - Keep awake indefinitely.2 - Keep awake for a timed interval.3 - Keep awake until a specific date/time.Default: 0
Number of hours to keep the system awake (used when mode is 2).
Type: integer
Range: 0 to 999
Default: 0
Number of minutes to keep the system awake (used when mode is 2).
Type: integer
Range: 0 to 59
Default: 1
The date and time when Awake should automatically disable (used when mode is 3).
Type: string (ISO 8601 datetime format)
Format: "YYYY-MM-DDTHH:mm:ss.fffffffzzz"
Example: "2025-12-31T23:59:59.0000000-08:00"
Custom time intervals displayed in the system tray context menu for quick activation.
Type: object
Description: A dictionary of custom time presets for quick access. Keys
are display names, values are time specifications.
This example configures Awake to keep the system and display awake indefinitely using direct execution.
$config = @{
settings = @{
properties = @{
keepDisplayOn = $true
mode = 1
}
name = "Awake"
version = "0.0.1"
}
} | ConvertTo-Json -Depth 10 -Compress
PowerToys.DSC.exe set --resource 'settings' --module Awake --input $config
This example configures a timed keep-awake period.
dsc config set --file awake-timed.dsc.yaml
# awake-timed.dsc.yaml
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: Configure Awake for 2 hours
type: Microsoft.PowerToys/AwakeSettings
properties:
settings:
properties:
keepDisplayOn: true
mode: 2
intervalHours: 2
intervalMinutes: 0
name: Awake
version: 0.0.1
This example configures Awake to stay active until a specific date and time.
winget configure winget-awake-scheduled.yaml
# winget-awake-scheduled.yaml
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json
metadata:
winget:
processor: dscv3
resources:
- name: Install PowerToys
type: Microsoft.WinGet.DSC/WinGetPackage
properties:
id: Microsoft.PowerToys
source: winget
- name: Keep awake until end of workday
type: Microsoft.PowerToys/AwakeSettings
properties:
settings:
properties:
keepDisplayOn: true
mode: 3
expirationDateTime: "2025-10-18T17:00:00.0000000-07:00"
name: Awake
version: 0.0.1
This example disables Awake using direct execution.
$config = @{
settings = @{
properties = @{
mode = 0
}
name = "Awake"
version = "0.0.1"
}
} | ConvertTo-Json -Depth 10 -Compress
PowerToys.DSC.exe set --resource 'settings' --module Awake --input $config
This example keeps the system awake while allowing the display to turn off.
dsc config set --file awake-system-only.dsc.yaml
# awake-system-only.dsc.yaml
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: Keep system awake only
type: Microsoft.PowerToys/AwakeSettings
properties:
settings:
properties:
keepDisplayOn: false
mode: 1
name: Awake
version: 0.0.1
This example configures Awake for a presentation scenario using WinGet.
winget configure presentation-mode.yaml
# presentation-mode.yaml
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json
metadata:
winget:
processor: dscv3
resources:
- name: Enable Awake for presentation
type: Microsoft.PowerToys/AwakeSettings
properties:
settings:
properties:
keepDisplayOn: true
mode: 2
intervalHours: 4
intervalMinutes: 0
name: Awake
version: 0.0.1
This example tests whether Awake is configured for indefinite keep-awake.
$desired = @{
settings = @{
properties = @{
keepDisplayOn = $true
mode = 1
}
name = "Awake"
version = "0.0.1"
}
} | ConvertTo-Json -Depth 10 -Compress
$result = PowerToys.DSC.exe test --resource 'settings' --module Awake --input $desired | ConvertFrom-Json
if ($result._inDesiredState) {
Write-Host "Awake is configured for indefinite keep-awake"
} else {
Write-Host "Awake configuration differs from desired state"
}
This example retrieves the current Awake settings.
PowerToys.DSC.exe get --resource 'settings' --module Awake | ConvertFrom-Json | ConvertTo-Json -Depth 10
This example retrieves the JSON schema for Awake module properties.
PowerToys.DSC.exe schema --resource 'settings' --module Awake | ConvertFrom-Json | ConvertTo-Json -Depth 10
Keep the system awake during long-running builds or installations:
resources:
- name: Keep awake during build
type: Microsoft.PowerToys/AwakeSettings
properties:
settings:
properties:
mode: 2
intervalHours: 8
intervalMinutes: 0
keepDisplayOn: false
name: Awake
version: 0.0.1
Ensure the system stays awake during presentations:
resources:
- name: Presentation mode
type: Microsoft.PowerToys/AwakeSettings
properties:
settings:
properties:
mode: 1
keepDisplayOn: true
name: Awake
version: 0.0.1
Keep the system awake until a specific time for scheduled tasks:
resources:
- name: Maintenance window
type: Microsoft.PowerToys/AwakeSettings
properties:
settings:
properties:
mode: 3
expirationDateTime: "2025-10-19T02:00:00.0000000-07:00"
keepDisplayOn: false
name: Awake
version: 0.0.1