Bulk Publish WVD Application Groups to Azure AD Groups with Powershell
With the lack of a Administrative GUI, managing Windows Virtual Desktop can be a tedious task.
I’ve put together a quick little script to bulk publish Windows Virtual Desktop Application Groups to a group of Office 365/Azure AD users.
Open Powershell, and Install and Import the WVD module by running the following commands:
Install-Module -Name Microsoft.RDInfra.RDPowerShell
Import-Module -Name Microsoft.RDInfra.RDPowerShell
Modify the first four variables below to suit your environment:
# Change these four variables to suit your environment
$hostPoolName = "HOST-POOL-NAME"
$WVDTenantName = "WVD-TENANT-NAME"
$appGroupName = "Desktop Application Group"
$userGroup = "Your MSOL Group Name"
#Don't modify below here
$Credential = Get-Credential
Add-RdsAccount -DeploymentUrl "https://rdbroker.wvd.microsoft.com" -Credential $Credential
Connect-MsolService -Credential $Credential
$appGroup = Get-RdsAppGroup $WVDTenantName $hostPoolName $appGroupName
$publishUserGroup = Get-MsolGroup -SearchString $userGroup
$usersToPublish = Get-MsolGroupMember -GroupObjectId $publishUserGroup.ObjectId
ForEach($member in $usersToPublish){
Write-host $member.DisplayName
$curUser = Get-MsolUser -SearchString "$($member.DisplayName)"
Write-Host "$($appGroupName) published to $($curUser.UserPrincipalName)" -ForegroundColor Green
Add-RdsAppGroupUser $WVDTenantName $hostPoolName $appGroupName -UserPrincipalName $curUser.UserPrincipalName
}
}