Skip to main content

New-CloudPCMaintenanceWindow

Creates a Windows 365 Cloud PC maintenance window.

Description

Creates a Cloud PC maintenance window by calling Microsoft Graph beta: POST /deviceManagement/virtualEndpoint/maintenanceWindows.

Use the weekday and weekend parameters for the common Intune portal model, or pass one or more schedule objects with -Schedule for newer Graph schedule types. Each schedule must be at least two hours long.

Pass -GroupId to assign the created maintenance window to Microsoft Entra groups after creation.

Syntax


New-CloudPCMaintenanceWindow -DisplayName <string> -WeekdayStartTime <string> -WeekdayEndTime <string> [-Description <string>] [-NotificationLeadTimeInMinutes <int>] [-WeekendStartTime <string>] [-WeekendEndTime <string>] [-GroupId <string[]>] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]

New-CloudPCMaintenanceWindow -DisplayName <string> -Schedule <Object[]> [-Description <string>] [-NotificationLeadTimeInMinutes <int>] [-GroupId <string[]>] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]

Parameters

NameTypeRequiredAliasesDescription
DescriptionStringNoOptional description.
DisplayNameStringYesDisplay name for the maintenance window.
ForceSwitchParameterNoSuppress confirmation prompts. Equivalent to -Confirm:$false.
GroupIdString[]NoMicrosoft Entra group IDs to assign after the maintenance window is created.
NotificationLeadTimeInMinutesInt32NoNumber of minutes before the maintenance window opens that users are notified.
Defaults to 60.
ScheduleObject[]YesOne or more hashtables or objects with scheduleType, startTime, and endTime.
Times may be HH:mm or Graph time-of-day values such as 01:00:00.0000000.
WeekdayEndTimeStringYesEnd time for the weekday schedule in HH:mm format.
WeekdayStartTimeStringYesStart time for the weekday schedule in HH:mm format.
WeekendEndTimeStringNoOptional end time for the weekend schedule in HH:mm format.
If omitted, the weekday end time is used for the weekend schedule.
WeekendStartTimeStringNoOptional start time for the weekend schedule in HH:mm format.
If omitted, the weekday start time is used for the weekend schedule.

Graph endpoints

/beta/deviceManagement/virtualEndpoint/maintenanceWindows
/beta/deviceManagement/virtualEndpoint/maintenanceWindows/{id}/assign

Example 1

New-CloudPCMaintenanceWindow -DisplayName 'Off-Hours Window' -WeekdayStartTime '01:00' -WeekdayEndTime '05:00' -Force

Creates a maintenance window with matching weekday and weekend schedules.

Example 2

New-CloudPCMaintenanceWindow -DisplayName 'Resize Window' -WeekdayStartTime '01:00' -WeekdayEndTime '05:00' -GroupId '<group-id>' -Force

Creates a maintenance window and assigns it to a Microsoft Entra group.

Source

View New-CloudPCMaintenanceWindow.ps1 on GitHub