3 set CLIENT_NAME=client.com
5 ECHO ****************************************************************
6 ECHO WARNING: This script will not remove service certificates on a
7 ECHO client machine from a cross machine run of this
10 ECHO If you have run WCF samples that use Certs across machines,
11 ECHO be sure to clear the service certs that have been installed in
12 ECHO the CurrentUser - TrustedPeople store.
13 ECHO To do this, use the following command:
15 ECHO "certmgr.exe -del -r CurrentUser -s TrustedPeople -c -n <Fully Qualified Server Machine Name>"
19 ECHO "certmgr.exe -del -r CurrentUser -s TrustedPeople -c -n server1.contoso.com"
21 DEL client.cer > NUL 2>&1
22 DEL service.cer > NUL 2>&1
26 REM cleans up certs from previous runs.
31 echo -------------------------
33 echo -------------------------
34 certmgr.exe -del -r CurrentUser -s My -c -n %CLIENT_NAME%
35 certmgr.exe -del -r CurrentUser -s TrustedPeople -c -n localhost
37 echo -------------------------
38 echo del service certs
39 echo -------------------------
40 certmgr.exe -del -r LocalMachine -s My -c -n localhost
41 certmgr.exe -del -r LocalMachine -s TrustedPeople -c -n %CLIENT_NAME%
42 certmgr.exe -put -r LocalMachine -s My -c -n %COMPUTER_NAME% computer.cer
43 IF %ERRORLEVEL% EQU 0 (
46 echo "You have a certificate with a Subject name matching your Machine name."
47 echo "If this certificate is from a cross machine run of WCF samples press any key to delete it."
48 echo "Otherwise press Ctrl + C to abort this script."
50 certmgr.exe -del -r LocalMachine -s My -c -n %COMPUTER_NAME%
54 echo *****************
55 echo Cleanup completed
56 echo *****************
62 REM Puts the Fully Qualified Name of the Computer into a variable named COMPUTER_NAME
63 for /F "delims=" %%i in ('cscript /nologo GetComputerName.vbs') do set COMPUTER_NAME=%%i