Сброс тестового периода для терминального сервера windows

После завершения активации сервера лицензирования, который включен в ОС Microsoft, и установки лицензий выдается льготный период лицензирования продолжительностью 120 дней. По истечении данного срока достаточно заново активировать сервер лицензирования, чтобы сбросить счетчик дней и продолжить использование терминального сервера.

В данной статье мы рассмотрим способ сброса данного льготного периода.

1. Переходим в редактор реестра. Для этого нажимаем сочетание клавиш WIN+R и вводим regedit. В редакторе реестра открываем раздел:

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

Сброс льготного периода терминального сервера Windows

2. После этого нажимаем правой кнопкой мыши на раздел GracePeriod и переходим в Разрешения

Сброс льготного периода терминального сервера Windows

3. В появившемся окне нажимаем Дополнительно

4. Далее нам потребуется сменить владельца раздела и разрешить ему полный доступ. Для смены владельца нажмите на Изменить в поле Владелец.

Сброс льготного периода терминального сервера Windows

5. В качестве владельца раздела установим группу Администраторы. Нажав кнопку Проверить имена можно сделать проверку наличия этой группы — если она существует, то имя группы станет подчеркнутым. Нажимаем ОК для сохранения изменений.

Сброс льготного периода терминального сервера Windows

6. Для выхода из дополнительных параметров безопасности еще раз нажимаем ОК, чтобы сохранить внесенные изменения. Затем в окне разрешений выбираем группу Администраторы и ставим галочку для разрешения полного доступа. Также нажимаем ОК и возвращаемся в открытый раздел в редакторе реестра.

7. Теперь в редакторе реестра нам необходимо удалить параметр L$RTMTIMEBOMB_<…>. Для этого нажимаем на него правой кнопкой мыши и выбираем Удалить. Если на предыдущих шагах вы корректно сменили владельца и назначили права, то удаление произойдет без проблем.

Сброс льготного периода терминального сервера Windows

8.Закрываем редактор реестра и перезагружаем сервер для применения изменений.

9. Для проверки того, что льготный период сбросился, вы можете воспользоваться командной строкой. Для этого нажмите сочетание клавиш WIN+R, введите cmd, после этого в открывшемся окне выполните команду:
wmic /namespace:\\root\CIMV2\TerminalServices PATH Win32_TerminalServiceSetting WHERE (__CLASS !=»») CALL GetGracePeriodDays

Сброс льготного периода терминального сервера Windows

For those who regularly connect to office or site networks through Remote Desktop, remote connectivity problems are nothing new. Some of these problems are simply caused by network glitches, network misconfigurations, or system problems.  If you work with Microsoft Windows Server and Remote Desktop Services (RDS), You may encounter the following error message when trying to connect to a Windows Server Remote Desktop Session Host (RDSH) server:

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

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

The remote session was disconnected

What is Remote Desktop Services RDS Licensing

When you install Windows Server 2016 or 2019 alongside previous versions of Windows, you get the usual ability to have two sessions that you would normally have available for management. However, when you install the appropriate Remote Desktop Services role, you have the option of having multiple sessions on your server.

By default, when you install the RDS role, you have a 120-day grace period provided by Microsoft to properly license the server you use as your RDS installation. Once the 120-day grace period has expired, you will see The remote session was disconnected because there are no Remote Desktop License Servers available to provide a license. Please contact the server administrator error when you attempt to RDP to the server.

In this case, the client’s computer may try to connect to the RDSH server using an expired temporary RDP license (if the RDS license server was not available when the client first connected, the customer has a temporary RDP license for 120 days. ). In this case, You can either redeploy your Windows server, which will allow you to start a new grace period of 120 days or you must reset this expired license in the registry of RDS Server.

Also Read : –

  1. How to Fix Error Code 0x80004005 Unspecified in Windows 10/11
  2. How to fix error 0x00000bc4, No printers were found in Windows 11

If Remote Desktop Licensing Diagnostics reports correct license information and does not find any errors or problems, the problems may be due to an apparent bug in Windows Server where the RDSH server fails to contact the license server after the grace period has expired of the 120 day license. Before starting, a few caveats. Registry editing can completely destroy your Windows system, so be careful with low-level registry editing and make sure to take a registry backup.

Please follow the below steps to reset the RDS Grace Period.

Apply the instructions below, only if you’re using the RDS Server 2012. 2016, 2019 on a testing environment. I will talk about the remote connection problem caused by the RDS license. Remote Desktop licenses are also known as client access licenses (CALS). This license can be purchased from Microsoft and configured on servers with connectivity issues.

  • Press the Windows Key then press “R“.
  • Type “regedit” in the run box and hit “OK“.
  • Navigate to the following location.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod
  •  Right-click at the ‘GracePeriod’ key and select Permissions.

There is no default permission for this key, not even for administrators. Before you can remove the time constraint value, you must first take ownership of the key. Click the Advanced button in the Permissions dialog box.

Reset 120 day RDS Grace period using Registry on Windows Server

Click the Change button next to the Owner.

Reset 120 day RDS Grace period using Registry on Windows Server-2

Here, we have selected the local administrator’s group as the main owner. However, you must select the user/group to use to delete the registry key. Select options to override owners and override all child object permissions.

Reset 120 day RDS Grace period using Registry on Windows Server-3

Confirm the replacement of permissions on the registry key GracePeriod.

Confirm replacing permissions GracePeriod

Now that we’ve changed the ownership of the key, we can actually set permissions without getting permission errors. Here I give administrators full control over the GracePeriod Key.

Now, with permissions set, right-click the timebomb value in the GracePeriod key and Delete. Or you can Delete GracePeriod Key From the RCM.

Reset GracePeriod RDS

Confirm the deletion of the registry entry.

Delete-GracePeriod

Then all you have to do is restart your server. After restarting the server, you can enjoy the full 120 day grace period of your RDS server in the lab environment again.

Restart Server for-Reset RDS GracePeriod

Video Overview of the Process

Задача: Столкнулся что у меня на тестовом сервере для подрядчиков (пилят переход 1С 7.7 на 1С 8 или работу в паре) настал момент, когда Grace Period использования роли терминального сервера начал подходить к концу, оставалось около 9 дней бесплатного использования (из 120 дней полнофункционального использования).

  • ISO образ из которого установлена система: SW_DVD9_Win_Server_STD_CORE_2016_64Bit_English_-4_DC_STD_MLF_X21-70526.ISO
  • OS: Windows Server 2016 Std (Microsoft Windows [Version 10.0.14393])

Как всегда, сперва просили терминальный сервер для подрядчиков, а уже сейчас это сложная система с различными доступами в боевую сеть, хранилище конфигурации, доступы мобильных клиентов для отладки, но только я знаю, как оно устроено и что от чего зависит.

Для решения своей задачи я обратился к своего блогу: https://win.ekzorchik.ru где есть заметка "Как сбросить grace period TS Windows Server 2016"

но вот попытавшись на текущем месте работы проделать все по ней столкнулся:

Шаг №1: Смотрим количество дней, оставшихся в использовании терминальным сервером из 120 дефолтных, как оценочные:

Logon (Administrator) in system: srv-ts01

wmic /namespace:\\root\CIMV2\TerminalServices PATH Win32_TerminalServiceSetting where (__CLASS !="") call getgraceperioddays | findstr /I "DaysLeft"
        DaysLeft = 8;

Шаг №2: Обнаружил что в заметке ссылка на скачивание утилиты subinacl.msi битая, нашел в своем домашнем хранилище софта нужную утилиту. Ссылку поправил. Скачал, устанавливаю в текущую систему, каталог установки по умолчанию: C:\Program Files (x86)\Windows Resource Kits\Tools\, оставляю. После копирую из данного каталога, установленного по умолчанию утилиту subinacl.exe в каталог C:\Windows\system32

Win + X - Command Prompt (Admin)

C:\Users\Administrator>subinacl.exe
SubInAcl version 5.2.3790.1180
Invalid Argument !
Use :
SubInacl /help to get the usage information
or
SubInAcl /help syntax to understand SubInAcl syntax.

Шаг №3: Применяю действия из заметки по сбросу Grace Period:

Win + X - Command Prompt (Admin)

C:\Users\Administrator>mkdir c:\test

(Сохраняем права доступа для раздела реестра)

subinacl.exe /output=c:\test\grace.txt /subkeyreg "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod"
Elapsed Time: 00 00:00:00
Done:        1, Modified        0, Failed        0, Syntax errors        0
Last Done  : HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod

(Забираем владельца у ключа GracePeriod)

subinacl.exe  /subkeyreg "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod" /setowner=Administrators
SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod : builtin\administrators is the new owner
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod : 1 change(s)
Elapsed Time: 00 00:00:00
Done:        1, Modified        1, Failed        0, Syntax errors        0
Last Done  : HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod
C:\Users\Administrator>

(Устанавливаем полные права доступа на ключ реестра GracePeriod)

C:\Users\Administrator>subinacl.exe  /subkeyreg "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod" /grant=Administrators=F
WARNING : Error parsing line + /subkeyreg
Use :
SubInacl /help to get the usage information
or
SubInAcl /help syntax to understand SubInAcl syntax.

Elapsed Time: 00 00:00:00
Done:        0, Modified        0, Failed        0, Syntax errors        1
Last Syntax Error:WARNING : Error parsing line + /subkeyreg

Вот почему ошибка, я ведь делаю эти шаги уже не первый раз и иногда вылезает непонятная ошибка парсинга синтаксиса, а вот просто команду выше выделил еще раз, скопировал в буфер и вставил, и она успешно отработала:

C:\Users\Administrator>subinacl.exe  /subkeyreg "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod" /grant=Administrators=F
SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod : delete Perm. ACE 4 builtin\administrators
SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod : new ace for builtin\administrators
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod : 2 change(s)


Elapsed Time: 00 00:00:00
Done:        1, Modified        1, Failed        0, Syntax errors        0
Last Done  : HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod
C:\Users\Administrator>

(Удаляем ключ ответственный за триал период в 120 дней)

C:\Users\Administrator>reg delete "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod" /v L$RTMTIMEBOMB_1320153D-8DA3-4e8e-B27B-0D888223A588 /f
The operation completed successfully.

На заметку: действия по изменению прав доступа выше обязательно должны отработать у Вас в противном случае Вы не сможете удалить ключ реестра ответственный за триал период в 120 дней.

(Возвращаю изначально выставленные системой права доступа на реестр)

Возвращаю изначально выставленные системой права доступа на реестр

На заметку: между subinacl.exe и ключом /subkeyreg не дожно быть более одного пробела

subinacl.exe /subkeyreg -> только один пробел должен быть

только тогда команда отработала

C:\Users\Administrator>subinacl.exe /subkeyreg "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod" /deny=Administrators=
SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod : delete Perm. ACE 4 builtin\administrators
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod : 1 change(s)


Elapsed Time: 00 00:00:00
Done:        1, Modified        1, Failed        0, Syntax errors        0
Last Done  : HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod

C:\Users\Administrator>subinacl.exe /subkeyreg "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod" /grant=Administrators=QEYA
SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod : new ace for builtin\administrators
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod : 1 change(s)


Elapsed Time: 00 00:00:00
Done:        1, Modified        1, Failed        0, Syntax errors        0
Last Done  : HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod

C:\Users\Administrator>subinacl.exe /subkeyreg "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod" /setowner="NETWORK SERVICE"
SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod : nt authority\network service is the new owner
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod : 1 change(s)


Elapsed Time: 00 00:00:00
Done:        1, Modified        1, Failed        0, Syntax errors        0
Last Done  : HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod

C:\Users\Administrator>

(Отлично! Отправляем систему в перезагрузку активации)

C:\Users\Administrator> shutdown /r /t 3

(Проверяем количество дней на использование)

C:\Users\Administrator>wmic /namespace:\\root\CIMV2\TerminalServices PATH Win32_TerminalServiceSetting where (__CLASS !="") call getgraceperioddays | findstr /I "DaysLeft"

        DaysLeft = 119;

C:\Users\Administrator>

Шаг №3: А теперь рассмотрим действия которые можно сделать не прибегая к установке утилиты subinacl.exe в систему, делать будем GUI средствами системы. Запускаем реестр (regedit.exe) предварительно авторизовавшись в системе с правами локального Администратора:

Win + R - regedit.exe

открываем ключ:

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

через правый клик мышью на GracePeriod открываем Permissions, Advanced.

По умолчанию владельцем значится: Owner: Network Services

Дефолтные права на каталог GracePeriod в реестре

нажимаем Change, указываем учетную запись Administrator и отмечаем галочкой Replace owner on subcontainers and objects и Replace all child object permission entries with inheritable permission entries from this object

(см. скриншот ниже для наглядного понимания)

Изменяю права доступа на каталог GracePeriod в реестре

нажимаю Apply, Yes, OK

После чего группу Administrators даем все права: Full Control отмечаем галочкой и нажимаем Apply, OK

(см. скриншот ниже для наглядного понимания)

и только теперь у текущей учетной записи (Login: Administrator) есть права на удаление ключа ответственного за триал период в 120 дней, через правый клик мышью на нем и выбираю Delete, Yes

(см. скриншот ниже для наглядного понимания)

Удаляю ключ ответственный за триал период в 120 дней

Затем отправляю систему в перезагрузку, после система автоматически создал необходимый ключ и у Вас снова 120 дней полнофункционального использования роли терминального сервера.

Win + X - Shut down or sign out - Restart, Continue

На заметку: Можно, как и через консоль командной строки с применение утилиты subinacl.exe вернуть права на реестр, а можно и оставить как есть дабы в дальнейшем уже не прибегать к помощи данной заметки.

На заметку: Заметки по Grace Period опубликованные для Server 2008 R2, 2012R2, Server 2016, Server 2019 с учетом данной все действующие и работоспособные.

Итого: Когда один раз делаешь что-либо, составляешь заметку и порой все по ней отрабатывает, а если проходит много времени, возвращаясь к ней всегда всплывают нюансы, которые тогда посчитал не сильно значимыми и не отразил их в заметке, но я не забыл на этот раз и дополнил заметку — а это Важно. Так по большей части только мне и предстоит ждать помощи только от себя самого.

Заметка работоспособна, на этом у меня все, с уважением автор блога Олло Александр aka ekzorchik.

  • per
  • in Articoli
  • on Giugno 21, 2024

0

To ensure the proper functioning of the Remote Desktop Services role in Windows Server, it is necessary to install the appropriate CAL licenses, but a 120-day trial period for the licenses is provided starting from the moment the role is installed. During this trial period, Remote Desktop Services operates without any installed CAL licenses. This allows an organization to set up and test their Remote Desktop Services environment to ensure everything works as expected before purchasing and installing CAL licenses.

It is possible to reset this trial period, but please note that resetting the trial period does not replace the purchase and installation of the required Remote Desktop CAL licenses. The following steps should not be performed on a production server.

To reset the trial period for Remote Desktop Services licenses, follow these steps:

  1. On the Remote Desktop Session Host, start the Registry Editor (regedit) as an administrator.
  2. In the Registry Editor, navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\GracePeriod.
  3. Within this registry key, there is a REG_BINARY entry whose name starts with the string L$RTMTIMEBOMB. This is likely the only entry in this key. The default permissions for this entry do not allow it to be modified or deleted. Therefore, these permissions need to be changed.
  4. Right-click on the GracePeriod folder in the left pane of the Registry Editor and choose Permissions.
  5. In the Permissions window that appears, select Administrators and grant this group Full Control permissions. Click OK to close the window.
  6. Right-click on the L$RTMTIMEBOMB… registry entry and choose Delete. Click Yes to confirm the deletion.
  7. Exit the Registry Editor.
  8. Restart the Remote Desktop Session Host server for the registry change to take effect.

You can verify the success of this procedure by using the Remote Desktop Licensing Diagnoser tool from the Tools menu in Server Manager. Clients should now be able to connect to this session host without the applicable CAL licenses. We reiterate that this procedure should not replace the purchase and installation of Remote Desktop CAL licenses and should only be performed in a non-production environment (i.e., test/lab).

References:

  1. How to Reset the Windows Remote Desktop Services Licensing Grace Period
  2. Enable multiple RDP sessions on Windows Server 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.

Error-after-120-day-grace-period-has-expired-for-Remote-Desktop-Services

Error after 120 day grace period has expired for 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:

  • https://docs.microsoft.com/en-us/windows-server/remote/remote-desktop-services/rds-client-access-license

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:

  1. 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.
  2. Backup: It’s highly recommended to backup the registry before running this script, as deleting registry keys can affect system functionality.
  3. Testing: Test the script in a non-production environment first to ensure it behaves as expected.
  4. 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:

  1. Change permissions on the RCM > GracePeriod key
  2. Delete the “Timebomb” registry entry
  3. 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.

Navigate-to-the-RDS-GracePeriod-key

Navigate to the RDS GracePeriod key

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.

Navigate-to-the-Advanced-permissions-properties

Navigate to the Advanced permissions properties

Click the Change button next to the Owner.

Change-the-ownership-of-the-registry-key

Change the ownership of the registry key

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.

User-for-ownership-selected-and-set-to-replace-permissions-on-child-objects

User for ownership selected and set to replace permissions on child objects

Confirm the replacement of permissions on the registry key.

Confirm-replacing-permissions

Confirm replacing permissions

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.

Change permissions for the user you want to be able to delete the key

Now, with permissions set, right-click the timebomb value in the GracePeriod key and Delete.

Delete-the-timebomb-key

Delete the timebomb key

Confirm the deletion of the registry entry.

Confirm-deletion-of-the-timebomb-key-in-the-registry

Confirm deletion of the timebomb key in the registry

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.

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Как увеличить шрифт на компьютере windows 10 на рабочем столе
  • Benq g2220hd драйвер windows 10
  • Acer s271hl драйвер для windows 10
  • Windows 7 characters sounds
  • Микрофон отключен в операционной системе windows 10