Skip to content

Instantly share code, notes, and snippets.

@jrgcubano
Created November 6, 2014 10:48
Show Gist options
  • Save jrgcubano/3d2966a92d59b0eabc97 to your computer and use it in GitHub Desktop.
Save jrgcubano/3d2966a92d59b0eabc97 to your computer and use it in GitHub Desktop.
Create and delete cert
Create Cert : (bat)
------------------------------------
echo off
set SERVER_NAME=localhost
echo ---------------------------------------------------------------------
echo cleaning up the certificates from previous run
certmgr.exe -del -r CurrentUser -s TrustedPeople -c -n %SERVER_NAME%
certmgr.exe -del -r LocalMachine -s My -c -n %SERVER_NAME%
echo ---------------------------------------------------------------------
echo Server cert setup starting
echo for server: %SERVER_NAME%
echo making server cert
makecert.exe -sr LocalMachine -ss MY -a sha1 -n CN=%SERVER_NAME% -sky exchange -pe
echo copying server cert to client's CurrentUser store
certmgr.exe -add -r LocalMachine -s My -c -n %SERVER_NAME% -r CurrentUser -s TrustedPeople
echo ---------------------------------------------------------------------
Delete Cert
------------------
echo off
set SERVER_NAME=localhost
echo ---------------------------------------------------------------------
echo cleaning up the certificates from previous run
certmgr.exe -del -r CurrentUser -s TrustedPeople -c -n %SERVER_NAME%
certmgr.exe -del -r LocalMachine -s My -c -n %SERVER_NAME%
echo cleanup completed
echo ---------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment