Skip to main content

Invoke-CloudPCEndGracePeriod

Ends the grace period for one or more Windows 365 Cloud PCs.

Description

Calls Microsoft Graph beta https://graph.microsoft.com/beta/deviceManagement/virtualEndpoint/cloudPCs/{id}/endGracePeriod to end the grace period for a Cloud PC.

Ending grace period immediately deprovisions the Cloud PC without waiting the seven-day grace period. Use Get-CloudPC -ProvisioningStatus inGracePeriod to review targets before invoking this action.

The service processes this action asynchronously. After Graph accepts the request, the Cloud PC can continue to appear as inGracePeriod for several minutes while Windows 365 state converges. Use -Wait to poll until the Cloud PC leaves inGracePeriod or the timeout is reached.

Syntax


Invoke-CloudPCEndGracePeriod -CloudPC <Object> [-Force] [-Wait] [-PollIntervalSeconds <int>] [-TimeoutSeconds <int>] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]

Invoke-CloudPCEndGracePeriod -Id <string> [-Force] [-Wait] [-PollIntervalSeconds <int>] [-TimeoutSeconds <int>] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]

Invoke-CloudPCEndGracePeriod -All [-Force] [-Wait] [-PollIntervalSeconds <int>] [-TimeoutSeconds <int>] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]

Parameters

NameTypeRequiredAliasesDescription
AllSwitchParameterYesEnds grace period for every Cloud PC returned by Get-CloudPC -ProvisioningStatus inGracePeriod.
CloudPCObjectYesA WindowsCloudPC.CloudPC object returned by Get-CloudPC, or an exact Cloud PC identifier.
ForceSwitchParameterNoSuppress confirmation prompts. Equivalent to -Confirm:$false.
IdStringYesCloudPcIdThe Cloud PC ID.
PassThruSwitchParameterNoEmit a WindowsCloudPC.EndGracePeriodResult object for each target.
PollIntervalSecondsInt32NoSeconds between wait checks. Defaults to 30.
TimeoutSecondsInt32NoMaximum seconds to wait. Defaults to 600.
WaitSwitchParameterNoPoll after a successful request until the Cloud PC leaves inGracePeriod,
is no longer returned, or TimeoutSeconds is reached.

Output

CloudPcId : 00000000-0000-0000-0000-000000000000
CloudPcName : CPC-GRACE-01
Status : Accepted
RequestedAt : 6/19/2026 3:30:00 PM
CompletedAt :
WaitRequested : False
WaitTimedOut : False
LastObservedProvisioningStatus : inGracePeriod
ExpectedStateLag : 5-10 minutes
VerificationCommand : Get-CloudPC -ProvisioningStatus inGracePeriod,deprovisioning | Where-Object Id -eq '00000000-0000-0000-0000-000000000000'
ErrorMessage :

Graph endpoints

/beta/deviceManagement/virtualEndpoint/cloudPCs/{id}/endGracePeriod

Example 1

Get-CloudPC -ProvisioningStatus inGracePeriod

Example 2

Invoke-CloudPCEndGracePeriod -CloudPC 'CPC-USER-01' -WhatIf

Example 3

Invoke-CloudPCEndGracePeriod -All -WhatIf

Example 4

Invoke-CloudPCEndGracePeriod -CloudPC 'CPC-USER-01' -Force -PassThru -Wait

Source

View Invoke-CloudPCEndGracePeriod.ps1 on GitHub