Getting started
Requirements
- PowerShell 7 or Windows PowerShell 5.1.
- Microsoft Graph PowerShell authentication through
Connect-MgGraph. - A Microsoft Entra account with permissions to read or operate Windows 365 Cloud PCs.
Install from the PowerShell Gallery
Install-Module WindowsCloudPC -Scope CurrentUser
Update an existing install with:
Update-Module WindowsCloudPC
Use the latest source build
git clone https://github.com/bwya77/PSWindowsCloudPC.git
Import-Module .\PSWindowsCloudPC\WindowsCloudPC.psd1 -Force
Connect to Microsoft Graph
Connect-CloudPC
Connect-CloudPC requests the read scopes used across the module. Commands that perform write actions, such as restart, reprovision, and snapshot creation, request CloudPC.ReadWrite.All only when needed.
If you already connected to Microsoft Graph in the same session, the module reuses that connection when the required scopes are present.
First useful queries
Get-CloudPC | Format-Table Name,ProvisioningStatus,AssignedUserUpn
Get-CloudPCUsage | Format-Table CloudPcName,UsageStatus,DaysSinceLastSignIn
Get-CloudPCByProvisioningPolicy | Format-Table DisplayName,ProvisioningType,CloudPCCount
First write operation
Use -WhatIf before running fleet-impacting commands.
Get-CloudPC -UserPrincipalName user@contoso.com |
Restart-CloudPC -WhatIf
When the preview looks correct:
Get-CloudPC -UserPrincipalName user@contoso.com |
Restart-CloudPC -Force
Output style
Commands return PowerShell objects, not formatted strings. That means you can pipe results into Where-Object, Sort-Object, Export-Csv, Format-Table, or other automation.
Get-CloudPCUsage |
Where-Object UsageStatus -eq 'Idle' |
Sort-Object DaysSinceLastSignIn -Descending |
Export-Csv .\idle-cloudpcs.csv -NoTypeInformation