Reset 120 day RDS Grace period on 2016 and 2019
If you have a home lab environment or another lab where you continually test various solutions, licensing, and trial expiration is a challenge that you constantly tend to run into. It is just part of the fun of lab environments. While most trials are fairly โhard and fastโ and donโt allow you to reset the trial expiration, if you work with Microsoft Windows Server and Remote Desktop Services (RDS), there is a โhackโ that allows you to effectively reset the expiration of Remote Desktop Services grace period where you can essentially rewind the clock on your RDS licensing if you are making use of this role inside your lab environment. I am using Windows Server 2019 for my Windows workloads in my lab environment. In this post, I will show how to reset 120 day RDS licensing Grace period on 2016 and 2019 Windows Server. Letโs see.
Remote Desktop Services RDS Licensing
When you install Windows Server 2016 or 2019 as with previous Windows versions, you get the normal ability to have the two sessions you generally have available for administering.
However, when you install the true Remote Desktop Services role, you can have multiple sessions on your server. This is similar to the legacy Terminal Server role in previous versions of windows.
Production vs testing purposes
Typically in a production environment, you will have remote desktop license servers that house the client access licenses and then you will have multiple session host server instances configured for hosting user sessions.
When you install the role, by default, you have a 120-day grace period that Microsoft gives you to license the server for use as an RDS installation properly. This is accomplished by configuring remote desktop license servers with client access licenses. If you are using a server in a lab environment, most likely, you are not going to license this type of server outside of production in a testing environment, using a license server with a remote desktop session host.
RDS grace period error message
Once the 120 day grace period has expired, you will see the following error when you attempt to RDP to the server, referring to the licensing server needed for the proper license past the grace period. Windows will deactivate the ability to connect using Remote Desktop Services.
You can either redeploy your Windows Server which will allow you to spin up a new 120 day grace period, or you can actually reset the grace period. If you are like me, the latter is certainly the path of least resistance and work involved. Letโs take a look at how to reset the 120 day RDS grace period.
You can take a closer look at the official licensing documentation for Remote Desktop Services here:
Reset 120 day RDS Grace period on 2016 and 2019
For resetting the 120 day grace period for the RDS role, the registry editor is your friend and makes this process easy. Before we begin, there are a couple of disclaimers to make here. Editing the registry can result in totally destroying a Windows system, so proceed with any low-level registry edits with caution. Creating a quick snapshot of the Windows virtual machine before you begin is always a good practice if you are working with a virtual machine.
Important Considerations:
- Run as Administrator: This script needs to be run with Administrator privileges due to the modifications it makes to the system registry and service control.
- Backup: It’s highly recommended to backup the registry before running this script, as deleting registry keys can affect system functionality.
- Testing: Test the script in a non-production environment first to ensure it behaves as expected.
- Legal and Compliance: Resetting the RDS grace period is intended for testing and evaluation purposes. Ensure compliance with Microsoft licensing agreements and terms of service when using this script.
Overview of resetting the grace period
Additionally, for production systems, resetting the 120 day grace period should only be done for systems that are not in production, as you should have proper licensing installed for production use.
To reset the grace period, there are actually just 3 steps involved:
- Change permissions on the RCM > GracePeriod key
- Delete the โTimebombโ registry entry
- Reboot the server
Now that we have level-set, once you have your snapshot or other backup created, you need to navigate to the following key location on your RDS server:
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod
We will manipulate the registry to extend or renew the RDS grace period back to the 120-day period.ย
Change Permissions on the RDS GracePeriod key and delete the key
Open a command prompt, and type regedit. After you have navigated to the key documented above, right-click GracePeriod and select Permissions.
For obvious reasons, there are no default permissions on this key for even Administrators. So you have to first take ownership of the key before you can delete the timebomb value. Click the Advanced button on the permissions dialog box.
Click the Change button next to the Owner.
Here I have selected local administrators group as the owner of the key. However, you will want to choose whichever user/group you want to use to delete the registry key. Select the options to replace owners and replace all child object permissions.
Confirm the replacement of permissions on the registry key.
Now that we have changed ownership on the key, we can actually set permissions without getting permissions errors. Here I am granting administrators full control on the key.
Now, with permissions set, right-click the timebomb value in the GracePeriod key and Delete.
Confirm the deletion of the registry entry.
Next, the only thing left to do is reboot your server. Once the server is rebooted, you can enjoy once again having the full 120 day grace period for your RDS server in the lab environment.
Reset 120-day grace period using PowerShell
Now that we have seen how to do this manually, let’s see how we can do this using PowerShell. Make sure to back up your registry before running any type of script that manipulates registry settings.
# Define the path to the RDS grace period registry key
$registryPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod"
# Check if the registry key exists
if (Test-Path $registryPath) {
try {
# Take ownership of the registry key
takeown /f $registryPath /r /d y
# Assign full control permissions to the Administrators group
$acl = Get-Acl $registryPath
$permission = "Administrators","FullControl","ContainerInherit,ObjectInherit","None","Allow"
$accessRule = New-Object System.Security.AccessControl.RegistryAccessRule $permission
$acl.SetAccessRule($accessRule)
Set-Acl $registryPath $acl
# Remove the registry key
Remove-Item -Path $registryPath -Recurse
Write-Host "The RDS Grace Period registry key has been successfully removed."
} catch {
Write-Error "An error occurred while removing the RDS Grace Period registry key: $_"
}
} else {
Write-Host "The RDS Grace Period registry key does not exist. No action is necessary."
}
# Restart the Remote Desktop Licensing service
try {
Restart-Service TermService -Force
Write-Host "The Remote Desktop Services have been restarted successfully."
} catch {
Write-Error "An error occurred while restarting the Remote Desktop Services: $_"
}
Wrapping up
The process to reset 120 day RDS Grace period on 2016 and 2019 Windows Servers as well as older server versions such as Windows Server 2012 and 2012 R2 is very straightforward using this process to delete the timebomb registry key.
Keep in mind this is not supported and certainly not a process for running in production. However, it is very handy for lab environments to keep from having to redeploy Windows Server virtual machines to have a fresh 120 day grace period.
Thanks for this!
How often can you reset the RDS grace period?
Extending the Windows Server trial period is limited to 6 times.
Have you verified that 6 resets is the maximum? For Server 2022?
What if RDS feature was uninstalled and reinstalled? Would it go 120 days again?
Mike,
Honestly, I have reset it this many times, only a couple in various lab environments. I am not sure what happens when you hit 6 or more. Is this a documented limitation you have seen?
Brandon
Does it work on server 2022??
yes it does
Yes
thank you i got it to work. I am almost done testing. just waiting for wow to install the fiber lines than i can go live. thankyou again it did work on 2022
John,
Thanks for the comment! I’m glad the process is still working on Windows Server 2022.
Brandon
you can use it as many times you want i am running a home lab wich sometimes need to be spun up and i have resetted it 12 times already and still working.
i only need this machine 6 times and only for testing purposes.
Great Article, very helpful
You dont need to Reboot the Server. Just restarting Remotedesktopservices Service does the job for me
Thank you, that was very helpful to me.
I have create a service program that will automatic remove this registerkey values.
Feel free to have a try.
github.com/WanpengQian/RRKS
great master, how do I install this program? Thank you for the instruction!
Hi.
When is actually the right time to do the reset. Is it before end grace days or after hit the above error prompt ?
Because with the error prompt, i couldn;t get RDP access anymore.
Pls advise
Najmi,
I believe the timebomb registry key gets created when the time runs out. So I don’t think you can reset it before it errors. However, it is fairly quick to reset the time once the key is created.
Brandon
hi thank you i got it to work. I am almost done testing. thankyou again it did work on 2024
mehdi,
Thank you for the comment and glad it is working!
Brandon
I get an error when executing the script (run as admin):
takeown /f $registryPath /r /d y
ERROR: File or Directory not found.
ws 2022, i think the key is locked by some process.