Win 2012 R2 RDS Powershel cmdlets
Using PowerShell to control RDS in Windows Server 2012 (Part 1)
The Battle of Renaming the RDS Server – 10 Steps of Troubleshooting
Problem:
After renaming RDS server , the connection broker and SessionHost remain with old name. Collection pointing to the old server
Resolution:
For resolving the problem will use Powershell cmdlets
Get-RDServer
Get-RDSessionCollection -Connection Broker “Servername”
Remove RD Session Collection
Remove-RDSessionCollection -CollectionName “Collection Name” -ConnectionBroker “ServerName” -Force
Remove RD Server
Remove-RDServer “ServerName” -Role RDS-RD-SERVER -ConnectionBroker “ServerName
Restart the server
Reinstall RDS Broker Role
Remove-WindowsFeature -Name RDS-Connection-Broker
Add-WindowsFeature -Name RDS-Connection-Broker
Create new deployment, collection, Session Host and Connection broker:
New-SessionDeployment -ConnectionBroker SERVER.CONTOSO.COM -WebAccessServer SERVER.CONTOSO.COM -SessionHost SERVER.CONTOSO.COM
New-RDSessionCollection -CollectionName SessionCollection -SessionHost SERVER.CONTOSO.COM -CollectionDescription “Session Collection for RDS Server” -ConnectionBroker SERVER.CONTOSO.COM
Pointing the server to the new license server if needed:
$obj = gwmi -namespace “Root/CIMV2/TerminalServices” Win32_TerminalServiceSetting
$obj.SetSpecifiedLicenseServerList(“SERVER.CONTOSO.COM”)
Check if it is connected to the new license server
$obj = gwmi -namespace “Root/CIMV2/TerminalServices” Win32_TerminalServiceSetting
$obj.GetSpecifiedLicenseServerList()
To change the licensing mode on RDSH/RDVH:
$obj = gwmi -namespace “Root/CIMV2/TerminalServices” Win32_TerminalServiceSetting
$obj.ChangeMode(value) – Value can be 2 – per Device, 4 – Per user