Posted On October 21, 2020

PowerShell: How to Install Remote Desktop Services

kimconnect 0 comments
blog.KimConnect.com >> Windows >> PowerShell: How to Install Remote Desktop Services
Prerequisites:

Required ports for RDS Services
– UDP/TCP 135 ingress/egress
– UDP/TCP 137-139 ingress/egress
– TCP 445 ingress/egress
– TCP 49152-65535 egress

Main Steps in Installing RDS Services
# Import module
import-module remotedesktop

# New deployment
$connectionBroker='IRV-SERVER76'
$webAccessServer='AWS-SERVER23'
$sessionHost='IRV-SERVER77'
New-SessionDeployment -ConnectionBroker $connectionBroker -WebAccessServer $webAccessServer -SessionHost $sessionHost

# Adding more RDS Hosts
$rdsHost='IRV-SERVER78'
Add-RDServer -Server $rdsHost -Role RDS-RD-SERVER -ConnectionBroker $connectionBroker

# Add Licensing
$rdsLicenseServer='IRV-SERVER56'
Add-RDServer -Server $rdsLicenseServer -Role RDS-LICENSING -ConnectionBroker $connectionBroker
Set-RDLicenseConfiguration -LicenseServer $rdsLicenseServer -Mode PerUser -ConnectionBroker $connectionBroker

# Check licensing
Get-RDLicenseConfiguration

# Create RDS Collections
$collectionName='APP01Collection'
New-RDSessionCollection -CollectionName $collectionName -SessionHost $connectionBroker -CollectionDescription 'Remote Desktop Sessions for APP01' -ConnectionBroker $connectionBroker

# Publish an App - Note that this published Chrome will run as Local to the RDS Host (Intranet)
New-RDRemoteapp -Alias GoogleChrome -DisplayName GoogleChrome -FilePath "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -ShowInWebAccess 1 -CollectionName $collectionName -ConnectionBroker $connectionBroker
Extraneous Commands
# Removing an RDS Host
Remove-RDServer -Server "IRV-TESTRDSHOST" -Role 'RDS-RD-SERVER' -ConnectionBroker $connectionBroker

# Adding an RDS Gateway
$rdsGateway='app01.hooli.com'
Add-RDServer -Server $rdsGateway -Role "RDS-GATEWAY" -ConnectionBroker $connectionBroker -GatewayExternalFqdn $rdsGateway

# Adding an RDS Virtualization Server
$rdsVirtualizationServer='virtualrds.hooli.com'
Add-RDServer -Server $rdsVirtualizationServer -Role "RDS-VIRTUALIZATION" -ConnectionBroker $connectionBroker -CreateVirtualSwitch
Manually install RDS Services Role on an individual Server
# Check if the Remote Desktop Session Host feature is available
Get-WindowsFeature | where name -Like “rds*”

Display Name Name Install State
------------ ---- -------------
[ ] Remote Desktop Connection Broker RDS-Connection-Broker Available
[ ] Remote Desktop Gateway RDS-Gateway Available
[ ] Remote Desktop Licensing RDS-Licensing Available
[X] Remote Desktop Session Host RDS-RD-Server Installed
[ ] Remote Desktop Virtualization Host RDS-Virtualization Available
[ ] Remote Desktop Web Access RDS-Web-Access Available
[ ] Remote Desktop Licensing Tools RDS-Licensing-UI Available

# Add the Remote Desktop Session Host feature to the server
Install-WindowsFeature RDS-RD-Server -IncludeManagementTools

# Add RDS-Licensing
Install-WindowsFeature RDS-Licensing,RDS-Licensing-UI
Check Licenses
$tsLicenseServer=$env:computername

Get-CIMInstance -computername $tsLicenseServer Win32_TSLicenseKeyPack `
-filter "TotalLicenses!=0"|?{$_.TypeAndModel -ne 'Built-in TS Per Device CAL'} | `
select-object -Property @{n='LicenseServer';e={$_.PSComputerName}}, `
TypeAndModel,TotalLicenses,IssuedLicenses,AvailableLicenses,ExpirationDate,ProductVersion

Sample Output:

LicenseServer : IRV-RDLICENSE02
TypeAndModel : RDS Per User CAL
TotalLicenses : 200
IssuedLicenses : 40
AvailableLicenses : 160
ExpirationDate : 12/31/2037 5:00:00 PM
ProductVersion : Windows Server 2019
Checking TS Licensing Clearinghouse
[IRV-RDSHost]: PS C:\Users\adminguy\Documents> get-item 'registry::HKLM\Software\Microsoft\TermServLicensing\lrwiz\Params'

Hive: HKLM\Software\Microsoft\TermServLicensing\lrwiz

Name Property
---- --------
Params (default) :
1.2.840.113549.1.9.1 :
dwBpAG4AZABvAHcAcwAtAGEAZABtAGkAbgBAAGkAbgB0AGUAcgBuAGUAdABiAHIA
YQBuAGQALgBjAG8AbQA=

2.5.4.10 :
TQBIACAAUwB1AGIAIABJACwAIABMAEwAQwAgAEQAQgBBACAASQBuAHQAZQByAG4A
ZQB0ACAAQgByAGEAbgBkAHMA

2.5.4.11 : SQBUAA==

2.5.4.13 : VQBTAA==

2.5.4.15 : RQBOAFQARQBSAFAAUgBJAFMARQA=

2.5.4.17 : OQAwADIANAA1AA==

2.5.4.3 : VwBpAG4AZABvAHcAcwA=

2.5.4.4 : QQBkAG0AaQBuAA==

2.5.4.6 : VQBuAGkAdABlAGQAIABTAHQAYQB0AGUAcwA=

2.5.4.7 : RQBsACAAUwBlAGcAdQBuAGQAbwA=

2.5.4.8 : QwBBAA==

2.5.4.9 :
OQAwADkAIABOACAAUABhAGMAaQBmAGkAYwAgAEMAbwBhAHMAdAAgAEgAdwB5ACwA
IABGAEwAIAAxADEA

ACTIVATIONMETHOD : MQA=

CH_EXTENSION : tlsonline\tlsext.dll
CH_PHONE_NO_LINK : https://activate.microsoft.com/
CH_RDLS_CONFIG_SERVER : rdls.blob.core.windows.net
CH_SERVER : clearinghouse.one.microsoft.com
LastRdlsConfigDownloadTime : {112, 173, 150, 162...}
LKPRC : 0
Param0 : {48, 130, 5, 237...}
Param1 : {}
Param2 : {48, 130, 18, 195...}
State : 0
WWW : https://activate.microsoft.com

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Microsoft SQL Server Error 18456

In a properly managed environment, the security team usually tracks the server logs for any…

Storage & Transfer Speed Unit of Measurement

Intro What's all this talk about bits and bytes? Why do hard drive manufacturers measure…

Desktop Virtualization Consideration

Information security would greatly improve with centralized desktop and data management. Early Launch Antimalware Detection,…
Other project: DragonCoin.com