4 echo cert setup starting
7 call :setscriptvariables %1
8 IF NOT DEFINED SUPPORTED_MODE call :displayusage
9 IF DEFINED SUPPORTED_MODE call :cleancerts
10 IF DEFINED SETUP_SERVICE call :setupservice
14 REM cleans up certs from previous runs.
19 echo -------------------------
21 echo -------------------------
22 certmgr.exe -del -r CurrentUser -s TrustedPeople -c -n localhost
24 echo -------------------------
25 echo del service certs
26 echo -------------------------
27 certmgr.exe -del -r LocalMachine -s My -c -n localhost
28 certmgr.exe -put -r LocalMachine -s My -c -n %COMPUTER_NAME% computer.cer
29 IF %ERRORLEVEL% EQU 0 (
32 echo "You have a certificate with a Subject name matching your Machine name: %COMPUTER_NAME%"
33 echo "If this certificate is from a cross machine run of WCF samples press any key to delete it."
34 echo "Otherwise press Ctrl + C to abort this script."
36 certmgr.exe -del -r LocalMachine -s My -c -n %COMPUTER_NAME%
40 echo *****************
41 echo Cleanup completed
42 echo *****************
49 echo Server cert setup starting
52 echo making server cert
54 makecert.exe -sr LocalMachine -ss MY -a sha1 -n CN=%SERVER_NAME% -sky exchange -pe
56 IF DEFINED EXPORT_SERVICE (
58 echo exporting service cert to service.cer
60 certmgr.exe -put -r LocalMachine -s My -c -n %SERVER_NAME% service.cer
63 echo copying server cert to client's CurrentUser store
65 certmgr.exe -add -r LocalMachine -s My -c -n %SERVER_NAME% -r CurrentUser -s TrustedPeople
70 REM Parses the input to determine if we are setting this up for a single machine, client, or server
71 REM sets the appropriate name variables
73 IF [%1]==[] CALL :singlemachine
74 IF [%1]==[service] CALL :service
80 echo Running setup script for Single Machine
84 SET SERVER_NAME=localhost
89 echo Running setup script for Service
94 SET SERVER_NAME=%COMPUTER_NAME%
98 REM Puts the Fully Qualified Name of the Computer into a variable named COMPUTER_NAME
99 for /F "delims=" %%i in ('cscript /nologo GetComputerName.vbs') do set COMPUTER_NAME=%%i
104 ECHO Single Machine - Setup.bat
105 ECHO Service Machine - Setup.bat service