Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> ระบบ >> Windows Server

Licensing Mode for Remote Desktop Session Host ไม่ได้ตั้งค่า

ตอนตั้งค่า RDSH Node ใหม่ใน RDS Farm รัน Windows Server 2012 R2/2016/2019 อาจเจอ Warning Popup ใน System Tray:

Licensing mode for the Remote Desktop Session Host is not configured.
Remote Desktop Service will stop working in 104 days.
On the RD Connection Broker server, use Server Manager to specify the Remote Desktop licensing mode and the license server.

จาก Error Message RDS Host รันใน Grace Period (ช่วง 120 วัน ใช้ RDSH โดยไม่ Activate RDS Licenses) เมื่อ Grace Period หมด Users จะ Connect เข้า RDSH ไม่ได้ Error ใน Tray:

Remote Desktop Services will stop working because this computer is past grace period and has not contacted at least a valid Windows Server 2012 license server. Click this message to open RD Session Host Server Configuration to use Licensing Diagnosis.

เคยอธิบายปัญหาคล้ายกันในบทความ RDS Error "The remote session was disconnected because there are no Remote Desktop License Servers available to provide a license" แต่ Situation ต่างออกไปนิดหน่อย

Diagnose ปัญหาแม่นยำ ใช้ Tool RD Licensing Diagnoser — lsdiag.msc (Administrative Tools → Remote Desktop Services → RD Licensing Diagnoser) Window แสดง Error:

Licenses are not available for the Remote Desktop Session Host server, and RD Licensing Diagnoser has identified licensing problem for the RD Session Host server. Licensing mode for the Remote Desktop Session Host is not configured. The Remote Desktop Session Host server is within its grace period, but the Session Host server has not been configured with any license server.

ไม่มี Licenses ให้ Clients เนื่องจาก Licensing Mode ไม่ได้ตั้งค่า

หมายถึง Admin ไม่ได้ระบุ RDS Licensing Server และ/หรือ Licensing Mode ควรทำแม้ Licensing Type ระบุตอน Deploy RDS Host แล้ว (Configure the deployment → RD Licensing → Select the Remote Desktop licensing mode)

ตรวจสอบว่า RDS License Server ตั้งค่าแล้วหรือยังด้วย PowerShell:

$obj = gwmi -namespace "Root/CIMV2/TerminalServices" Win32_TerminalServiceSetting
$obj.GetSpecifiedLicenseServerList()

หมายเหตุ: Get-RDLicenseConfiguration Cmdlet อาจ Return Data ผิดพลาด

หาก RDS License Server ยังไม่ Set ระบุด้วยคำสั่ง: $obj.SetSpecifiedLicenseServerList("uk-rdslic1.woshub.com")

หากไม่จำว่า RD License Role ติดตั้งบน Server ไหน แสดงรายการ RDS Licensing Servers ทั้งหมดใน AD Domain ด้วย Get-ADObject จาก PowerShell ActiveDirectory Module: Get-ADObject -Filter {objectClass -eq 'serviceConnectionPoint' -and Name -eq 'TermServLicensing'}

หลายวิธี Force Set RDS Licensing Mode

ผ่าน Registry

ใน Registry Key HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\Licensing Core เปลี่ยนค่า DWORD Parameter ชื่อ LicensingMode จาก 5 เป็น:

  • 2 — หากใช้ Per Device RDS Licensing Mode
  • 4 — หากใช้ Per User Licensing

เปลี่ยน Registry Manual ผ่าน regedit.exe หรือ PowerShell Commands:

# Specify RDS licensing type: 2 - Per Device CAL, 4 - Per User CAL
$RDSCALMode = 2
# RDS Licensing host name
$RDSlicServer = "uk-rdslic1.woshub.com"
# Set server name and licensing type in registry
New-Item "HKLM:\SYSTEM\CurrentControlSet\Services\TermService\Parameters\LicenseServers"
New-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Services\TermService\Parameters\LicenseServers" -Name SpecifiedLicenseServers -Value $RDSlicServer -PropertyType "MultiString"
Set-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\Licensing Core\" -Name "LicensingMode" -Value $RDSCALMode

หลังเปลี่ยน Restart RDSH Server

ผ่าน GPO (Local หรือ Domain Policy)

หาก RDS Server อยู่ใน Workgroup (ไม่ Join AD Domain) ใช้ Local Group Policy Editor gpedit.msc ไป Computer Configuration → Administrative Templates → Windows Components → Remote Desktop Services → Remote Desktop Session Host → Licensing

ต้องใช้ 2 Policies:

  • Use the specified Remote Desktop license servers — Enable Policy ระบุ RDS License Server Address หาก License Server รันบน Server เดียวกัน ใส่ 127.0.0.1
  • Set the Remote Desktop licensing mode — เลือก Licensing Mode ตัวอย่าง Per User

หลัง Restart Server เปิด RD Licensing Diagnoser ตรวจสอบจำนวน RDS Licenses ที่พร้อมใช้งานและ Licensing Mode ที่เลือก

หากใช้ Firewall บน Network ต้องเปิด Ports จาก RDSH Host ไป RDS Licensing Server — TCP:135, UDP:137, UDP:138, TCP:139, TCP:445, TCP:49152–65535 (RPC Range) ตรวจสอบ Open Ports ด้วย Test-NetConnection Cmdlet หาก Ports ปิดบน Local Windows Defender Firewall เปิดด้วย PowerShell Cmdlets จาก NetSecurity Module

สำคัญ: หาก RD Licensing Server ติดตั้ง Windows Server 2012 R2 และ CAL สำหรับ RDS 2012 R2 ไม่สามารถ Install RDS CAL Licenses สำหรับ Windows Server 2016/2019 ได้ Error "Remote Desktop Licensing mode is not configured" คงอยู่แม้ระบุ License Type และ RDS License Server Name ถูกต้อง Old Windows Server Version ไม่รองรับ RDS CALs สำหรับ Newer Versions

RD License Diagnoser จะแสดงข้อความ:

The Remote Desktop Session Host is in Per User licensing mode and no Redirector Mode, but license server does not have any installed license with the following attributes: Product version: Windows Server 2016 Use RD Licensing Manager to install the appropriate licenses on the license server.

ต้อง Upgrade Windows Server Version บน RDS License Server (หรือ Deploy RD License Host ใหม่) Windows Server Version ใหม่ (เช่น WS 2019) รองรับ RDS CAL สำหรับ Windows Server รุ่นก่อนทั้งหมด

หมายเหตุ: หาก RDS Server อยู่ใน Workgroup Licensing Report ไม่ Generate แม้ Terminal RDS Licenses ออกให้ Clients/Devices ถูกต้อง ต้อง Monitor จำนวน RDS CALs ที่เหลือเอง