Event ID - 2004

Event Id2004
SourceMicrosoft-Windows-TerminalServices-Gateway
DescriptionThe policy and server configuration settings for the TS Gateway server "%1" could not be exported. The following error occurred: "%2".
Event InformationAccording to Microsoft :
Cause :
This event is logged when the policy and server configuration settings for the TS Gateway server could not be exported.
Resolution :
Ensure that the required permissions are granted to the Core registry key, and if needed, delete and recreate TS RAPs and TS RAPs
To resolve this issue, ensure that the required permissions are granted to the Core registry key. If the problem persists, you might have to delete and recreate the Terminal Services resource authorization policies (TS RAPs) and the Terminal Services connection authorization policies (TS CAPs) on the TS Gateway server.
To perform these procedures, you must have membership in the local Administrators group, or you must have been delegated the appropriate authority.
Grant the required permissions to the Core registry key
Caution : Incorrectly editing the registry might severely damage your system. Before making changes to the registry, you should back up any valued data.
To grant the required permissions to the Core registry key:
  1. On the TS Gateway server, click Start, click Run, type regedit, and then press ENTER.
  2. Navigate to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\TerminalServerGateway\Config\Core subkey, right-click the subkey, and then click Permissions.
  3. In the Permissions for Core dialog box, under Group or user names, click SYSTEM. Under Permissions for SYSTEM, if Full control is not allowed, select the Allow check box adjacent to Full control.
  4. In the same dialog box, under Group or user names, click Administrators. Under Permissions for Administrators, if Full control is not allowed, select the Allow check box adjacent to Full control.
  5. Click OK.
  6. Try exporting the policy and configuration settings again.
  7. If the export is successful, the rest of the resolution steps in this topic do not apply.
If granting the required permissions to the Core registry key does not resolve the problem, try deleting and then recreating the TS RAPs and the TS CAPs on the TS Gateway server.
Delete and recreate the TS RAPs on the TS Gateway server
Note : After you rename rap.xml and restart TS Gateway Manager, no TS RAPs will appear, so you must reconfigure the TS RAP settings.
To back up and delete rap.xml and then open the TS Gateway Manager console:
  1. Navigate to %Windir%\System32\tsgateway\rap.xml, where %Windir% is the drive on which the operating system is installed.
  2. Save a backup copy of rap.xml by renaming rap.xml to rapbak.xml.
  3. Delete rap.xml.
  4. Open TS Gateway Manager. To open TS Gateway Manager, click Start, point to Administrative Tools, point to Terminal Services, and then click TS Gateway Manager.
  5. Reconfigure the TS RAP settings as needed.
  6. Try exporting the policy and configuration settings again.
Delete and recreate the TS CAPs on the TS Gateway server
If backing up and removing the current copy of Rap.xml and recreating the TS RAP settings does not resolve the problem, try renaming IAS.xml to IASbak.xml, and then starting TS Gateway Manager. Opening the console will create a new IAS.xml file.
Note : After you rename IAS.xml and restart TS Gateway Manager, no TS CAPs will appear, so you must reconfigure the TS CAP settings.
To back up and delete IAS.xml and then open TS Gateway Manager:
  1. Navigate to %Windir%\System32\ias\ias.xml, where %Windir% is the drive on which the operating system is installed.
  2. Save a backup copy of IAS.xml by renaming IAS.xml to IASbak.xml.
  3. Delete IAS.xml.
  4. Open TS Gateway Manager. To open TS Gateway Manager, click Start, point to Administrative Tools, point to Terminal Services, and then click TS Gateway Manager.
  5. Reconfigure the TS CAP settings as needed.
  6. Try exporting the policy and configuration settings again.
Verify :
To verify that the TS Gateway server is available for client connections, examine Event Viewer logs and search for the following event messages. These event messages indicate that the Terminal Services Gateway service is running, and that clients are successfully connecting to internal network resources through the TS Gateway server.
To perform this procedure, you do not need to have membership in the local Administrators group. Therefore, as a security best practice, consider performing this task as a user without administrative credentials.
To verify that the TS Gateway server is available for client connections:
  1. On the TS Gateway server, click Start, point to Administrative Tools, and then click Event Viewer.
  2. In the Event Viewer console tree, navigate to Application and Services Logs\Microsoft\Windows\TerminalServices-Gateway, and then search for the following events:
    • Event ID 101, Source TerminalServices-Gateway: This event indicates that the Terminal Services Gateway service is running.
    • Event ID 200, Source TerminalServices-Gateway: This event indicates that the client connected to the TS Gateway server.
    • Event ID 302, Source TerminalServices-Gateway: This event indicates that the client connected to an internal network resource through the TS Gateway server.
Reference LinksEvent ID 2004 from Source Microsoft-Windows-TerminalServices-Gateway

Catch threats immediately

We work side-by-side with you to rapidly detect cyberthreats
and thwart attacks before they cause damage.

See what we caught

Did this information help you to resolve the problem?

Yes: My problem was resolved.
No: The information was not helpful / Partially helpful.