Advertisement
dantpro

PKI-CA-Backup.cmd

Apr 1st, 2015
337
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.72 KB | None
  1. @echo off
  2.  
  3. Set BkpId=srv-ca01.txt
  4.  
  5. C:
  6. cd \CA\Backup\DB
  7.  
  8. %systemroot%\system32\certutil -backup -v -f -p Pa$$w0rd C:\CA\Backup\DB
  9.  
  10. cd \CA\Backup\REG
  11.  
  12. reg export HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CertSvc\Configuration srv-ca01-cfg.reg /y
  13. reg save HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CertSvc srv-ca01-cfg.hiv /y
  14.  
  15. ::reg load HKLM\Temp C:\CA\Backup\REG\srv-ca01-cfg.hiv
  16. ::reg unload HKLM\Temp
  17.  
  18.  
  19. net stop CertSvc && net start CertSvc
  20.  
  21. cd \CA\Backup\
  22.  
  23. ::echo. > %BkpId%
  24. echo Backup time: > %BkpId%
  25. echo. >> %BkpId%
  26. date /t >>%BkpId%
  27. echo.
  28. time /t >>%BkpId%
  29.  
  30. robocopy C:\CA\Backup\ \\DOMAIN\DFS\BackUp\PKI\SRV-CA01\ /PURGE /S /R:5 /W:60 /TEE /NP /LOG:C:\CA\Scripts\CA-Backup-Copy.log
Advertisement
RAW Paste Data Copied
Advertisement