WVD life cycle management is essential for many IT Pros and decision-makers. In this post, we would be able to see how to remove published remote apps with PowerShell.
Related Post – Learn How to Publish WVD Remote Apps with PowerShell
n a real-world scenario, you might need to remove the existing remote apps and add new remote apps. There are many things you need to take while running the PowerShell commands.
NOTE! – Try these PowerShell commands in your non-production environments before trying these commands in the production WVD environment.
Prerequisite – Remove WVD Remote Apps
Make sure that you have gone through all the prerequisites in place before removing remote apps from the RDS environment. I assume that you have a WVD tenant and already published remote apps to users.
NOTE! – Windows Virtual Desktop (WVD) has the restriction that within a host pool, a user cannot be assigned to both a desktop app group and a RemoteApp app group.
Install Azure AD, RD PowerShell Module
##Install & Import AzureAD Module
Install-Module -Name AzureAD
Import-Module -Name AzureAD
##Install & Import RD - WVD Module
Install-Module -Name Microsoft.RDInfra.RDPowerShell
Import-Module -Name Microsoft.RDInfra.RDPowerShell
Login to RD Account – Authenticate with Azure AD
## Login with Azure AD Account user name and password
Add-RdsAccount -DeploymentUrl https://rdbroker.wvd.microsoft.com
#Login to RDS account with Service Principle
$aadContext = Connect-AzureAD
$svcPrincipal = New-AzureADApplication -AvailableToOtherTenants $true -DisplayName "Windows Virtual Desktop Svc Principal"
$svcPrincipalCreds = New-AzureADApplicationPasswordCredential -ObjectId $svcPrincipal.ObjectId
$creds = New-Object System.Management.Automation.PSCredential($svcPrincipal.AppId, (ConvertTo-SecureString $svcPrincipalCreds.Value -AsPlainText -Force))
Add-RdsAccount -DeploymentUrl "https://rdbroker.wvd.microsoft.com" -Credential $creds -ServicePrincipal -AadTenantId $aadContext.TenantId.Guid
Set Variables – WVD Remote Apps
#Set the Variable
$hostpoolname ='WVD-A-MS-Apps'#$hostpoolname ='WVD-A-MS-Apps'
Identify Remote Apps Published to RemoteApp Group
Following PowerShell commands help you to confirm the remote app groups and host pool associated before removing the published remote apps.
- RDS App Group Details (Desktop App and Remote App Groups for the RDS Session Host)
- List of the apps associated to a RDS Remote App Group
- List of Users associated to RDS Remote App Group
NOTE – You might not have access to run this query if you are login to RDS using SPN. Instead, you might need to have appropriate access to Azure AD to list the users in Azure AD Group.
#Get the details of WVD Remote App Groups
Get-RdsAppGroup -TenantName $tenant -HostPoolName $hostpoolname
##List of Remote App Group
Get-RdsAppGroup -TenantName $tenant -HostPoolName $hostpoolname -AppGroupName $NameofappGroup2
##List of Users associated to Remote App Group
Get-RdsAppGroupUser -TenantName $tenant -HostPoolName $hostpoolname -AppGroupName $NameofappGroup2
WVD Remove Published Remote Apps
The following are the activities you might need to perform before removing published remote apps.
Remove User from Remote Apps Group
NOTE! – The WVD remote app groups should be empty before you can remove it.
##Remove the Users from Remote Apps Groups
Remove-RdsAppGroupUser -TenantName $tenant -HostPoolName $hostpoolname -AppGroupName $NameofappGroup2 -UserPrincipalName $UserPrincipalName
No Users Part of Remote Apps Groups?
##Make Sure NO Users are part of Remote App Groups
Get-RdsAppGroupUser -TenantName $tenant -hostpoolname $hostpoolname -appgroupname $NameofappGroup2
List of Published Remote Apps Associated to Remote App Group
Find the list of published remote apps associated with remote app group.
NOTE! – We need to remove all the published remote apps before removing the remote app group.
##Get the list of Published WVD Remote Apps
Get-RdsRemoteApp -TenantName $tenant -hostpoolname $hostpoolname -appgroupname $NameofappGroup2
Remove Published WVD Remote App
The following PowerShell command will help you to remove the published remote apps associated with an RDS remote group.
##Remove Remote App Version
Remove-RdsRemoteApp -TenantName $tenant -hostpoolname $hostpoolname -appgroupname $NameofappGroup2 -Name 'My Apps Web Portal Edge'
Remove-RdsRemoteApp -TenantName $tenant -hostpoolname $hostpoolname -appgroupname $NameofappGroup2 -Name 'Task Manager'
Remove Remote App Group
The following command will help us to remove the RDS remote apps groups.
NOTE! – This removal or deletion is possible only when there are no published apps that are not associated with that group.
## RD App Removal PowerShell Command
Remove-RdsAppGroup -TenantName $tenant -hostpoolname $hostpoolname -appgroupname $NameofappGroup2
- WVD Host Pool Creation Guide With New Template
- Install Subscribe Windows RD Client for WVD End User Step by Step Guide
- WVD Video Play List ➡➡https://aka.ms/WVDPlaylist
- WVD AMA 28th Aug 2019 Windows Virtual Desktop Microsoft WVD FAQs from AMA
- Microsoft VDI Story WVD Concept Setup Guide Myths Known Issues
- SCCM Intune Support for Persistent Non-Persistent VDI VMs
- How to Connect WVD Remote Desktop Resources Client or Browser?
- Troubleshooting overview, feedback, and support
- WVD Identify issues with the diagnostics feature