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

Remote Session Disconnected: ไม่มี Remote Desktop License Servers/Client Access Licenses

ในบทความนี้ เราจะดูปัญหาทั่วไปหลายประการที่เกี่ยวข้องกับ RDS Licensing เมื่อ RDP Clients ไม่สามารถเชื่อมต่อกับ Windows Server ที่มี Remote Desktop Services Host Role ติดตั้งได้

Licensing Errors เมื่อเชื่อมต่อ RDP Clients ไปยัง RDS Host อาจเกิดขึ้นหาก:

  • RDS Licensing Server ที่คุณต้องการรับ Client Licenses (RDS CALs) ไม่ได้ระบุใน Remote Desktop Services Settings;
  • RDS Licensing Server หมด CALs ที่พร้อมใช้งานแล้ว;
  • RDP Client พยายามเชื่อมต่อด้วย Temporary RDS License ที่หมดอายุ;

Remote session was disconnected because there are no Remote Desktop client access licenses available for this computer

ก่อนอื่น มาดู Error ที่เกี่ยวข้องกับ Clients ได้ RDS CALs จาก License Server

Remote session was disconnected because there are no Remote Desktop client access licenses available for this computer. Please contact the server administrator.

Remote Session Disconnected: ไม่มี Remote Desktop License Servers/Client Access Licenses

เชื่อมต่อกับ RDSH Server ใน Administrative Mode (mstsc.exe /admin) และรัน RD Licensing Diagnoser Tools หากทุกอย่างตั้งค่าถูกต้อง คุณควรเห็นชื่อ RDS Licensing Server และ License Type (Per User/Per Device)

Remote Session Disconnected: ไม่มี Remote Desktop License Servers/Client Access Licenses

เชื่อมต่อกับ RDS License Server โดยใช้ RD Licensing Manager Console (licmgr.exe) และตรวจสอบว่าคุณมี Free Licenses ที่พร้อมใช้งานของ Type ที่ต้องการ (Per User หรือ Per Device) หากคุณหมด Free RDS CALs คุณต้องซื้อ CAL Pack ใหม่ รอให้ใครปล่อย License หรือ Revoke Unused Licenses โดยตรงจาก Console (คลิกขวาที่ Computer/User และเลือก Revoke License)

Remote Session Disconnected: ไม่มี Remote Desktop License Servers/Client Access Licenses

ในตัวอย่างนี้ คุณเห็นว่ามี Free RDS CALs และถูก Issue ให้ Users (Issued = 44)

Hint หาก RDSH Server ของคุณ Deploy ใน Workgroup (ไม่ใช่ AD Domain) คุณ ไม่สามารถใช้ Per User RDS Licenses บนมันได้ เมื่อเชื่อมต่อ Users ของคุณจะได้รับ Temporary Local Per Device License เสมอ

น่าจะเป็นไปได้มากที่สุดว่าในกรณีนี้ Client Computer กำลังพยายามเชื่อมต่อกับ RDSH Server ของคุณด้วย Temporary RDP License ที่หมดอายุ (หาก RDS License Server ของคุณไม่พร้อมใช้งานเมื่อ Client เชื่อมต่อครั้งแรก Client จะได้รับ Temporary RDP License สำหรับ 180 วัน) ในกรณีนี้ คุณต้อง Reset Expired License นี้ใน Registry บน Client Device

ทำสิ่งต่อไปนี้บน Client Computer (Windows 10 ในตัวอย่างนี้):

  1. เริ่ม Registry Editor (regedit.exe);
  2. ลบ Registry Key HKEY_LOCAL_MACHINE\Software\Microsoft\MSLicensing;Remote Session Disconnected: ไม่มี Remote Desktop License Servers/Client Access Licenses
  3. ปิด Registry Editor และรัน mstsc.exe (Remote Desktop Connection) ในฐานะ Administrator;Remote Session Disconnected: ไม่มี Remote Desktop License Servers/Client Access Licenses
  4. เชื่อมต่อกับ RDS Server ของคุณ ในกรณีนี้ MSLicensing Reg Key จะถูก Re-create อัตโนมัติ และ Computer จะได้รับ RDP License ใหม่

หากคุณไม่ได้รัน mstsc.exe ด้วย Administrator Permissions Error จะปรากฏสำหรับการเชื่อมต่อ RDP ใดๆ:

The remote computer disconnected the session because of an error in the licensing protocol. Please try connecting to the remote computer again or contact your server administrator.

The remote session was disconnected because there are no Remote Desktop License Servers available to provide a license

ลูกค้ารายหนึ่งเจอปัญหากับ Farm ของ RDS Servers ที่ Deploy บน Windows Server 2012 R2 ด้วยเหตุผลบางอย่าง RDS Server หยุด Issue Terminal Licenses ให้ Users แม้ License Server Role จะถูกติดตั้งและตั้งค่า และ RDP CALs ถูก Activate แล้ว

เมื่อ User พยายามเชื่อมต่อกับ Terminal Server ผ่าน RDP Error ต่อไปนี้ปรากฏ:

The remote session was disconnected because there are no Remote Desktop License Servers available to provide a license. Please contact the server administrator.

Remote Session Disconnected: ไม่มี Remote Desktop License Servers/Client Access Licenses

เชื่อมต่อกับ Server Console ใน Administrative Mode (mstsc /admin) เปิด Server Manager และไปที่ RDS Settings (Remote Desktop Services -> Deployment Overview -> Tasks -> Edit Deployment Properties) ตรวจสอบว่า Remote Desktop License Server ที่ถูกต้องและ RDS CAL Type (Per Device หรือ Per User) ถูกระบุใน RDSH Configuration

Remote Session Disconnected: ไม่มี Remote Desktop License Servers/Client Access Licenses

คุณยังสามารถตรวจสอบ RDS Licensing Server Settings ผ่าน PowerShell ได้:

Get-RDLicenseConfiguration

Remote Session Disconnected: ไม่มี Remote Desktop License Servers/Client Access Licenses

ตามที่เห็น LicenseServer ถูกระบุใน Configuration และใช้ Licensing Type PerUser

ตรวจสอบว่า Ports ต่อไปนี้ไม่ถูกบล็อกโดย Firewalls เมื่อเข้าถึงจาก RDSH Host ไปยัง RDS Licensing Server: TCP 135, UDP 137, UDP 138, TCP 139, TCP 445, TCP 49152–65535 (RPC Range) หาก RDS License Server ไม่พร้อมใช้งาน License Diagnoser จะแสดง Error:

License server rdslic_hostname is not available. This could be caused by network connectivity problems, the Remote Desktop Licensing service is stopped on the license server, or RD Licensing isn't available.

Reset 120 Days RDS Grace Period (L$RTMTIMEBOMB)

ดู Events ใน Event Viewer บน RDS Host ให้ดี อาจมี Error อย่างนี้:

EventID: 1128 Source: TerminalServices-RemoteConnectionManager The RD Licensing grace period has expired and the service has not registered with a license server with installed licenses. A RD Licensing server is required for continuous operation. A Remote Desktop Session Host server can operate without a license server for 120 days after initial start up.

Remote Session Disconnected: ไม่มี Remote Desktop License Servers/Client Access Licenses

RD License Diagnoser น่าจะแสดง Error ด้วย:

The grace period for the Remote Desktop Session Host server has expired, but the RD Session Host server hasn't been configured with any license servers. Connections to the RD Session Host server will be denied unless a license server is configured for the RD Session Host server.

นี่หมายความว่า Grace Period สำหรับ RDSH Server ของคุณหมดอายุแล้ว และคุณต้อง Extend Grace Mode หรือ Activate Host บน RDS License Server

RDS Grace Period อนุญาตให้คุณใช้ Remote Desktop Services บน Windows Server ฟรีเป็นเวลา 120 วัน น่าจะเป็นไปได้มากที่สุดว่าเมื่อ Login เข้า RDSH ในฐานะ Administrator คุณเห็น Error:

Licensing mode for the Remote Desktop Session Host is not configured. Remote Desktop Service will stop working in 86 days.

จำนวนวันก่อนจบ RDS Grace Period สามารถหาได้จาก Elevated Command Prompt:

wmic /namespace:\\root\CIMV2\TerminalServices PATH Win32_TerminalServiceSetting WHERE (__CLASS !="") CALL GetGracePeriodDays

Remote Session Disconnected: ไม่มี Remote Desktop License Servers/Client Access Licenses

โปรดทราบว่า DaysLeft = 0 หมายความว่า Grace Period หมดอายุบน RDSH Host นี้แล้ว

เพื่อ Extend Grace Period ใน RDS คุณต้องลบ Registry Parameter บน Server ซึ่งกำหนด Grace Period Licensing Time วันที่กำหนด RDS Grace Period สำหรับ Server จัดเก็บใน Registry Parameter REG_BINARY L$RTMTIMEBOMB (ชื่อตลกมาก – TIME BOMB….) ตั้งอยู่ใน Registry Key ต่อไปนี้:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod

Remote Session Disconnected: ไม่มี Remote Desktop License Servers/Client Access Licenses

คุณต้องลบ Parameter L$RTMTIMEBOMB จาก Registry อย่างไรก็ตาม Administrator ไม่มี Permissions เพียงพอที่จะทำเช่นนี้

Unable to delete all specified values.

Remote Session Disconnected: ไม่มี Remote Desktop License Servers/Client Access Licenses

เพื่อลบ Registry Parameter นี้ คุณต้องเปิด Parent Key Permissions และให้ Account ของคุณมี Privileges ของ Key Owner จากนั้นตั้งค่า Full Control Permissions สำหรับ Administrators Group (ผมจะไม่อธิบายกระบวนการละเอียด)

Remote Session Disconnected: ไม่มี Remote Desktop License Servers/Client Access Licenses

ตอนนี้ คลิกขวา L$RTMTIMEBOMB Parameter และ Delete มัน

Remote Session Disconnected: ไม่มี Remote Desktop License Servers/Client Access Licenses

Restart RDSH Server ของคุณ และเชื่อมต่อด้วย RDP Client ตรวจสอบว่า RDS CAL ถูก Issue เรียบร้อยแล้วโดยใช้ Remote Desktop Licensing Manager

Remote Session Disconnected: ไม่มี Remote Desktop License Servers/Client Access Licenses

หาก RDS CAL ไม่ได้รับ ให้ตรวจสอบว่ามี Event ใน Event Viewer หรือไม่:

Event ID: 1130 Source: TerminalServices-RemoteConnectionManager The Remote Desktop Session Host server does not have a Remote Desktop license server specified. To specify a license server for the Remote Desktop Session Host server, use the Remote Desktop Session Host Configuration tool.

Remote Session Disconnected: ไม่มี Remote Desktop License Servers/Client Access Licenses

โดยใช้ PowerShell Command นี้ ตรวจสอบว่าตั้งค่า RDS Licensing Server แล้วหรือยัง:

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

Remote Session Disconnected: ไม่มี Remote Desktop License Servers/Client Access Licenses

ตามที่เห็น RDS Licensing Server ไม่ได้ตั้งค่า (SpecifiedLSList ว่าง) Force Set RD Licensing Server ด้วยคำสั่งต่อไปนี้:

$obj = gwmi -namespace "Root/CIMV2/TerminalServices" Win32_TerminalServiceSetting
$obj.SetSpecifiedLicenseServerList("lon-rdslic.woshub.com")

คุณยังสามารถตั้งค่า License Server Name และ License Type โดยใช้ Group Policy GPO หากคุณใช้ Local GPO ให้รัน gpedit.msc และไปที่ Section Computer Configuration -> Administrative Templates -> Windows Components -> Remote Desktop Services -> Remote Desktop Session Host -> Licensing ตั้งค่าตัวเลือกต่อไปนี้:

  • Use the specified Remote Desktop license servers
  • Set the Remote licensing mode

Remote Session Disconnected: ไม่มี Remote Desktop License Servers/Client Access Licenses

RDS Host จะสามารถรับ Licenses จาก RDS Licensing Server และ Issue ให้ RDP Users ของคุณได้แล้ว