Created
April 23, 2019 10:06
Revisions
-
OmerMicrosoft created this gist
Apr 23, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,53 @@ #Get Azure admin credentials Write-Host "Getting Azure credentials... " $Credentials = Get-Credential -Message "Enter your Azure admin credentials" #Add RDS Account in order to be able to change WVD configuration $BrokerURL = "https://rdbroker.wvd.microsoft.com" Write-Host "Adding the RDS account... " -NoNewline Try { Add-RdsAccount -DeploymentUrl $BrokerURL -Credential $Credentials -ErrorAction Stop | Out-Null } Catch { Write-Host "Failed to add the RDS account. Aborting." -ForegroundColor Red Break } Write-Host "Done." -ForegroundColor Green #Select WVD tenant Write-Host "Getting WVD tenants information... " -NoNewline Try { $RDSTenantName = (Get-RdsTenant).TenantName | Out-GridView -Title "Please select one WVD tenant from the list above" -OutputMode Single -ErrorAction Stop } Catch { Write-Host "Failed to get WVD tenant information. Aborting." -ForegroundColor Red Break } Write-Host "Done." -ForegroundColor Green #Select WVD hostpool within the tenant Write-Host "Getting WVD hostpools information... " -NoNewline Try { $RDSHostPoolName = (Get-RdsHostPool -TenantName $RDSTenantName).HostPoolName | Out-GridView -Title "Please select one hostpool from the list above" -OutputMode Single -ErrorAction Stop } Catch { Write-Host "Failed to get WVD hostpools information. Aborting." -ForegroundColor Red Break } Write-Host "Done." -ForegroundColor Green #Display current RDS users in the selected hostpool Write-Host "Getting WVD users information for $RDSHostPoolName in $RDSTenantName..." $RDSUsers = Get-RdsAppGroupUser -TenantName $RDSTenantName -HostPoolName $RDSHostPoolName -AppGroupName "Desktop Application Group" | Select UserPrincipalName Write-Host $RDSUsers.UserPrincipalName #Add additional RDS users Write-Host "###################################" -ForegroundColor Yellow $Answer = Read-Host "Press 'Y' if you would like to add additional RDS users to your hostpool" While ($Answer -ieq "Y") { $UserToAdd = Read-Host "Enter the user UPN (e.g. User@contoso.com)" try { Add-RdsAppGroupUser -TenantName $RDSTenantName -HostPoolName $RDSHostPoolName -AppGroupName "Desktop Application Group" -UserPrincipalName $UserToAdd } Catch { Write-Host "Failed to add user to the hostpool." -ForegroundColor Red Break } Write-Host "Succesfully add $UserToAdd to hostpool $RDSHostPoolName" -ForegroundColor Green $Answer = Read-Host "Press 'Y' if you would like to add additional RDS users to your hostpool" }