Share via

WVD syntax correction

Glenn Maxwell 13,761 Reputation points
2021-05-27T20:22:19.373+00:00

Hi

I am new to WVD and i am using wvd classic. I want to assign/remove the user to WVD app group. Please correct me if the below syntaxes are correct.

To create
Add-RdsAppGroupUser -TenantName "MyTenant" -HostPoolName "MyPool" -AppGroupName "WVD Desktop" -UserPrincipalName "******@mydomain.com"

To Delete WVD

Remove-RdsAppGroupUser -TenantName "MyTenant" -HostPoolName "MyPool" -AppGroupName "WVD Desktop" -UserPrincipalName "******@mydomain.com"

What is the syntax to get the session hostname for this wvd.

Get-RdsSessionHost -TenantName "MyTenant" -HostPoolName "MyPool" -AppGroupName "WVD Desktop" -UserPrincipalName "******@mydomain.com"

Get-RdsAppGroupUser -TenantName "MyTenant" -HostPoolName "MyPool" -AppGroupName "WVD Desktop" -UserPrincipalName "******@mydomain.com"

Azure Virtual Desktop
Azure Virtual Desktop

A Microsoft desktop and app virtualization service that runs on Azure. Previously known as Windows Virtual Desktop.


Answer accepted by question author

prmanhas-MSFT 17,976 Reputation points Microsoft Employee Moderator
2021-05-28T11:03:05.04+00:00

@Glenn Maxwell Thank you for your query!!!

First thing I would recommend you is to migrate from Classic which doesn't support Azure Resource Manager Windows Virtual Desktop objects and will as well retire in coming time. More info here.Final call is all yours though :)

To add users to the WVD App Group Classic as mentioned here below command is recommended:

Add-RdsAppGroupUser <tenantname> <hostpoolname> <appgroupname> -UserPrincipalName <userupn>

So the above syntax is correct which you have mentioned.

Similarly for removing user from Group as mentioned here:

Remove-RdsAppGroup
[-TenantName] <String>
[-HostPoolName] <String>
[-Name] <String>
[<CommonParameters>]

So above syntax is correct.

You can use below command for getting wvd session hostname for a user:

Get-RdsSessionHost
[-TenantName] <String>
[-HostPoolName] <String>
[-Name <String>]
[<CommonParameters>]

The Get-RdsSessionHost cmdlet gets the properties of the specified session host. If you do not specify a session host, this cmdlet returns all session hosts in the host pool.

So this one is correct as well as mentioned here.

Again the last one is correct as well. As mentioned here

The Get-RdsAppGroupUser cmdlet lists the users that have access to the specified app group. If you specify a user principal name, this cmdlet either returns the specified user principal name who has access to the app group or an error indicating that they do not have access.

Get-RdsAppGroupUser
[-TenantName] <String>
[-HostPoolName] <String>
[-AppGroupName] <String>
[-UserPrincipalName <String>]
[<CommonParameters>]

Overall syntax are correct and with needed access you are good to go.

Hope it help!!!

Please "Accept as Answer" if it helped so it can help others in community looking for help on similar topics.

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Glenn Maxwell 13,761 Reputation points
    2021-06-02T17:30:46.713+00:00

    I am getting the below error. user maxwell is able to login to WVD

    PS C:\Windows\system32> Get-RdsAppGroupUser -TenantName "MyTenant" -HostPoolName MyPool -AppGroupName "WVD Desktop" -UserprincipalName ******@mydomain.com
    UserPrincipalName : ******@mydomain.com
    TenantName : MyTenant
    TenantGroupName : Default Tenant Group
    HostPoolName : MyPool
    AppGroupName : WVD Desktop

    Get-RdsSessionHost -TenantName "MyTenant" -HostPoolName "MyPool" -AppGroupName "WVD Desktop" -UserPrincipalName "******@mydomain.com"
    Get-RdsSessionHost : A parameter cannot be found that matches parameter name 'AppGroupName'.
    At line:1 char:80

    • ... "MyTenant" -HostPoolName "MyPool" -AppGroupName "WVD ...
    • ~~~~~~~~~~~~~
    • CategoryInfo : InvalidArgument: (:) [Get-RdsSessionHost], ParameterBindingException
    • FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.RDInfra.RDPowershell.SessionHost.GetRdsSessionHost

    Get-RdsSessionHost -TenantName "MyTenant" -HostPoolName "MyPool" -AppGroupName "WVD Desktop" -Name "******@mydomain.com"
    Get-RdsSessionHost : A parameter cannot be found that matches parameter name 'AppGroupName'.
    At line:1 char:80

    • ... "MyTenant" -HostPoolName "MyPool" -AppGroupName "WVD ...
    • ~~~~~~~~~~~~~
    • CategoryInfo : InvalidArgument: (:) [Get-RdsSessionHost], ParameterBindingException
    • FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.RDInfra.RDPowershell.SessionHost.GetRdsSessionHost

    when i use the below syntax i am getting output but i am getting for all the users.

    Get-RdsSessionHost -TenantName "MyTenant" -HostPoolName "MyPool"

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.