Example Script for Validating Certificate Configuration

Applies To: Windows Server 2008

After you have completed certificate configuration for the TS Gateway server and Terminal Service client (as described in Configuring the TS Gateway Core Scenario), you can use the Rpcping.exe resource kit tool to confirm that the certificate configuration is correct. The following script provides an example of how you can use Rpcping.exe for this purpose. Rpcping.exe is available for download from Windows Server 2003 Resource Kit Tools (https://go.microsoft.com/fwlink/?LinkId=16544).

This appendix describes how to save the example script as a text file and run the script by using Rpcping.exe, and provides an example of successful output and the example script syntax.

Running the Rpcpingtest example script

To run this example script, use the following procedure. Note that you must run the script as a member of the local Administrators group on the TS Gateway server.

To run the example script

  1. Copy and paste the example script into a text file.

  2. Save the text file as Rpcpingtest.cmd.

  3. Open the command prompt, switch to the directory where Rpcping.exe is located, and then type Rpcpingtest.cmd.

  4. For example, if you saved Rpcping.exe to the C:\Tools directory, you would do the following:

    At the command prompt, type the following (replace TSGATEWAYSERVERNAME with the name of your TS Gateway server):

    C:\Tools\Rpcpingtest TSGATEWAYSERVERNAME <user name> <domain name>

  5. Press ENTER.

  6. Type the password for RPC/http proxy (the password for the TS Gateway server).

Example of successful output

If the script is successful and the certificate configuration is correct, output similar to the following will appear:

Results:  RPC/HTTP server preferred auth scheme is: 2   
Results:  Pinging successfully completed in 78 sec.
------------------------------------------------------------
Prompting for second rpc ping command in the scripting file
Enter the password for server:  <password for TS Gateway>
Enter the password for RCP/http Proxy:  <password for TS Gateway>

Results:  Completed 1 calls in 141 ms
Results: 7 T/S or 141.000 ms/T.

Rpcping example script

@echo off
setlocal
set _TARGETGATEWAY=%1
set _USERNAME=%2
set _DOMAINNAME=%3

if "%_TARGETGATEWAY%"      == "" goto DO_USAGE
if "%_USERNAME%"         == "" goto DO_USAGE
if "%_DOMAINNAME%"       == "" goto DO_USAGE

Echo *******************************************************************
Echo * The first RPCPing will authenticate to the RPC over HTTP
Echo * Proxy service. If this ping fails, then the certificate 
Echo * on the  client computer is not correctly  configured, 
Echo * or you might have entered the wrong password.
Echo *******************************************************************

Rpcping -v 2 -e 3388 -t ncacn_http -s localhost -o RpcProxy=%_TARGETGATEWAY% -P 
"%_USERNAME%,%_DOMAINNAME%,*" -H NTLM -u NTLM -a connect -F ssl -B msstd:%_TARGETGATEWAY% -E 
-R None

Echo *******************************************************************
Echo * The second RPCPing will attempt to authenticate to the TS
Echo * Gateway service. If this ping fails, then the TS Gateway 
Echo * service is probably not running.
Echo *******************************************************************

Rpcping -v 2 -e 3388 -t ncacn_http -s localhost -o RpcProxy=%_TARGETGATEWAY% -P 
"%_USERNAME%,%_DOMAINNAME%,*" -I "%_USERNAME%,%_DOMAINNAME%,*" -H NTLM -u NTLM -a connect -F 
ssl -B msstd:%_TARGETGATEWAY%

goto endall

:DO_USAGE
Echo ******************************************************************
Usage:                                                                *
Echo * testclient.cmd [gateway] [user] [domain/machine]               *
Echo *                                                                *
Echo ******************************************************************
goto endall
:ENDALL
Endlocal

Disclaimer

The sample script is not supported under any Microsoft standard support program or service. The sample script is provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample script and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the script be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.