Forum Discussion
Unable to remove session host "Session host not found"
- Mar 12, 2020This worked for me and in this order. Add-RdsAccount -DeploymentUrl "https://rdbroker.wvd.microsoft.com"
 Set-RdsHostPool -TenantName $myTenantName -Name "contosoHostPool" -ValidationEnv $trueAdd-RdsAccount -DeploymentUrl "https://rdbroker-r0.wvd.microsoft.com"
Thanks for the response michawets The session host name has a "-" in it, I don't know if that is causing any issues? The full command I'm trying is:
Remove-RdsSessionHost -TenantName "RDSTest" -HostPoolName "TestPool" -Name "RDSTEST-2012-1.eu.ad"
And that errors out with:
WARNING: One or more errors occurred.
Remove-RdsSessionHost :
ActivityId:
Powershell commands to diagnose the failure:
Get-RdsDiagnosticActivities -ActivityId
At line:1 char:1
+ Remove-RdsSessionHost -TenantName "RDSTest" -HostPoolName "Tes ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : FromStdErr: (Microsoft.RDInf...eRdsSessionHost:RemoveRdsSessionHost) [Remove-RdsSessionHost], RdsPowerShellException
+ FullyQualifiedErrorId : DefaultNoRdsError,Microsoft.RDInfra.RDPowershell.SessionHost.RemoveRdsSessionHost
If I mistype the session host name / dont use the FQDN then I get another error:
"Specified SessionHostName %%% does not exist in HostPoolName TestPool"
So its the correct name, but I've no idea why I cannot delete it. I'll attempt to create another session host today with no "-" in the name and see if i'm able to delete that host.
The "-" in the name is default when provisioning a host pool, which I had totally forgot. So that cant be anything to do with it. I've deployed another host pool into another tenant with corresponding session hosts, and the same issue is evident, I'm unable to remove them.
Using the web front end as well fails. "Failed to delete host, problem with server. Please try again"
Any help people can offer here would be appreciated, I've no idea what is going on.
- michawetsJul 23, 2019Iron ContributorHi Ben79 , Could you run a Get-RdsSessionHost for the same sessionhost? Could you post the output? Thx - Ben79Jul 23, 2019Copper ContributorHey michawets here is the output: Get-RdsSessionHost -TenantName $TenantName -HostPoolName $HostPoolName SessionHostName : RDSTEST-2012-1.eu.ad 
 TenantName : RDSTest
 TenantGroupName : Default Tenant Group
 HostPoolName : TestWin2008Pool
 AllowNewSession : True
 Sessions : 0
 LastHeartBeat : 23/07/2019 12:31:05
 AgentVersion : 1.0.833.5
 AssignedUser :
 OsVersion : 6.3.9600
 SxSStackVersion : rdp-sxs190429002
 Status : Available
 UpdateState : Succeeded
 LastUpdateTime : 22/07/2019 12:10:09
 UpdateErrorMessage :Piping the Get-RdsSessionHost host command to a remove session host, provides the exact same error as well. - michawetsJul 23, 2019Iron ContributorHi Ben79 , Could you install Fiddler? Then - close Powershell
- start Fiddler
- start Powershell
- redo the Remove-RdsSessionHost
- check the Fiddler output, looking for a call to TenantGroups/{tenantGroupName}/Tenants/{tenantName}/HostPools/{hostPoolName}/SessionHosts/{sessionHostName}
 Could you share the outcome of the HTTP call? Especially in the Inspectors, in the Response, the Raw output could be usefull