Deploy Windows 365 via Powershell

Stefan Dingemanse and I built a Powershell Module to deploy Windows 365 more easily. We wanted a new challenge. Stefan looked at the Powershell Gallery and there wasn’t a Windows 365 module. So, we decided to build one.

The module is available at the Powershell Gallery Full documentation is available on Github.

The Github page doesn’t show any pictures. So, I am going to show a simple example with screenshots, to really show the power of our module to the fullest extent. The example contains:

A provisioning policy where:

  • The machines are Azure AD Joined
  • They sit in a Microsoft Hosted Network (West Europe)
  • Single Sign-on is enabled
  • The image is Windows 11 – 22H2
  • The language is en-US (default value)
  • Manual Patching (Windows Autopatch is an option)

A user settings policy where:

  • Local Admin is disabled
  • Users are allowed to restore their own machines
  • The frequency of these restore points is 6 hours.

The policies assignment is also set with Powershell to “All Users”. You can set a custom group but for the example, this is enough.

Windows 365 Deployment


So, let’s dive in.

Firstly, download and install the module. You can do so using the following command:

Install-Module -Name PSCloudPC

After that, import the module:

Import-Module -Name PSCloudPC

If you want to see the new CMDlets available, run this command:

Get-Command -Module PSCloudPC

As a result, this output appears:

Now, we start the deployment.

Firstly, connect to Windows 365 using:

Connect-Windows365 -TenantID YOURTENANT.onmicrosoft.com

Enter your details and click sign in:

Deploy the Provisioning Policy using this command:

New-CPCProvisioningPolicy -Name AzureADJoin_NielsKok.Tech -Description AzureADJoin_NielsKok.Tech -RegionName westeurope -RegionGroup europeUnion -ImageId "MicrosoftWindowsDesktop_windows-ent-cpc_win11-22h2-ent-cpc-m365" -EnableSingleSignOn $true

As a result, this is the output in Powershell:

And this is the output in the portal:

Next, deploy the User Settings Policy by using this command:

New-CPCUserSettingsPolicy -Name UserSettings_NielsKok.tech -LocalAdminEnabled $false -UserRestoreEnabled $true -FrequencyInHours 6

As a result, this is the output in Powershell:

And, this is the output in the portal:

Lastly, we need to assign both policies. Use these commands to update the assignment:

Provisioning Policy:

Set-CPCProvisioningPolicyAssignment -Name AzureADJoin_NielsKok.Tech -GroupName 'All Users'

User Settings Policy:

Set-CPCUserSettingsPolicyAssignment -Name UserSettings_NielsKok.Tech -GroupName 'All Users'

After that, you can onboard your users in Windows 365!

In addition, you need to have your Intune configuration configured properly.

Furthermore, you can use these CMDlets to check the regions available and which images are available.c

For the regions:

Get-CPCSupportedRegion

Output:

And, the images: (Gallery and Custom)

Get-CPCGalleryImage | FT

Output:

Get-CPCCustomImage

References

Authentication Part of the module references this code

Other posts:
ZScaler Custom Compliance
Registering Windows365 images in Azure

Leave a Comment