Backtrack:  
 
by lunarg on October 29th 2020, at 09:19

When installing the Remote Desktop Session Host role on a Windows Server, you get a 120 days grace period where you do not need to specify a license server and/or have licenses installed. After the grace period, it is no longer possible to log in with even a single session through RDP, unless you use the admin console (/admin option). Luckily, you can reset this counter by getting rid of a specific key which gets created at the start of the grace period, effectively resetting the grace period counter. This can even be done if the grace period isn't completely over.

  1. Log in directly on the server (or use the /admin option) and fire up regedit.
  2. Navigate to the key: HKEY_LOCAL_MACHINE:\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod
  3. In there is a REG_BINARY value with the funky "timebomb" name. This value needs to be deleted but cannot be done just yet because we don't have the correct permissions.
  4. In the tree of keys, right-click the GracePeriod key, click Permissions, then the Advanced button and set ownership to the Administrator account, instead of NETWORK SERVICE. Also, give the Administrators group Full control.
  5. Click the L$RTMTIMEBOMB... value and delete it.
  6. Either restart the server or restart the Terminal Service service:
    Restart-Service TermService -Force

After restarting the service or the server, the grace period should be reset back to 120 days. You can check this through the following WMI query (run in Powershell):

(Invoke-WmiMethod -Path (gwmi -namespace root\cimv2\terminalservices -class win32_terminalservicesetting).__PATH -name GetGracePeriodDays).daysleft

There doesn't seem to be a limit to the number of times you can do this. Until Microsoft changes this behaviour, you probably can do this indefinitely. However, we are obligated to point out that if you use RDS in production environments, you are required to purchase the correct licenses!