Here is my script.  
The most important lines are :

1. reg.exe EXPORT "HKLM\SOFTWARE\Wow6432Node\DBU Consulting\Servers
Alive" "C:\ServersAlive\Backup\RegistryExport.reg" /y
=> exports the registry to a REG file

2. 7za.exe a "C:\ServersAlive\Backup\%$ZIP%" "C:\ServersAlive\config"
=> makes a copy of my entries file and HTML templates (in folder
"C:\ServersAlive\config") and puts it into a ZIP file
7za.exe is 7-zip CLI tool.

3.  7za.exe a "C:\ServersAlive\Backup\%$ZIP%" "C:\ProgramData\Woodstone"
-xr!sa_runtime.db
=> makes a copy the groups.grp file and appends it into a ZIP-file

The environment variable %$ZIP% contains a timestamp, ex. "yyyymmdd -
hhmmss ~ ServersAlive.zip"



::Pieter Demeulemeester
::12/02/2014
::Maakt backup van SA configuratie (registry+files)
::
::

@Echo Off
WhoAmI /Groups | Find "S-1-16-12288" > nul

If "%ERRORLEVEL%"=="0" (Goto :ELEVATED) Else (elevate.exe %0 %CD%)

Goto :EINDE
  
:ELEVATED
  Pushd %1
  For /F "tokens=1" %%a in ('wmic.exe OS GET LocalDateTime ^| find "."')
Do @Set DMTF=%%a  
  REM echo DMTF    : %DMTF%

  Set $JAAR=%DMTF:~0,4%
  Set $MAAND=%DMTF:~4,2%
  Set $DAG=%DMTF:~6,2%
  Set $UUR=%DMTF:~8,2%
  Set $MIN=%DMTF:~10,2%
  Set $SEC=%DMTF:~12,2%

  Set $ZIP=%$JAAR%%$MAAND%%$DAG%-%$UUR%%$MIN%%$SEC% ~ ServersAlive.zip

  Set $STATUS=OK

  cd /D c:\

  echo.
  Echo Export Registry
  reg.exe EXPORT "HKLM\SOFTWARE\Wow6432Node\DBU Consulting\Servers
Alive" "C:\ServersAlive\Backup\RegistryExport.reg" /y
  if not "%ERRORLEVEL%"=="0"  Set $STATUS=nok
  7za.exe a "C:\ServersAlive\Backup\%$ZIP%"
"C:\ServersAlive\Backup\RegistryExport.reg"
  if not "%ERRORLEVEL%"=="0"  Set $STATUS=nok

  echo.
  Echo Config files
  7za.exe a "C:\ServersAlive\Backup\%$ZIP%" "C:\ServersAlive\config" 
  if not "%ERRORLEVEL%"=="0"  Set $STATUS=nok

  echo.
  echo C:\ProgramData\Woodstone files (idem als C:\Users\All
Users\Woodstone)
  7za.exe a "C:\ServersAlive\Backup\%$ZIP%" "C:\ProgramData\Woodstone"
-xr!sa_runtime.db
rem   7za.exe a "C:\temp\test.zip" "C:\ProgramData\Woodstone"
-xr!sa_runtime.db

  if not "%ERRORLEVEL%"=="0"  Set $STATUS=nok

  echo.
  echo CMDchecks
  7za.exe a "C:\ServersAlive\Backup\%$ZIP%"
"C:\ServersAlive\ExternalChecks" 
  if not "%ERRORLEVEL%"=="0"  Set $STATUS=nok

  echo.
  echo Inetpub\WWWroot\ServersAlive
  7za.exe a "C:\ServersAlive\Backup\%$ZIP%"
"C:\inetpub\WWWroot\ServersAlive" 
  if not "%ERRORLEVEL%"=="0"  Set $STATUS=nok

  echo.
  Echo Extra
  7za.exe a "C:\ServersAlive\Backup\%$ZIP%" "C:\ServersAlive\Extra" 
  if not "%ERRORLEVEL%"=="0"  Set $STATUS=nok

  echo.
  echo.
  If "%$STATUS%"=="nok" (
    echo.
    echo **** ERROR ****
    echo.
    pause
    ) Else (
    echo Backup completed succesfully.
    choice /C Y /D Y /T 20 /N /M "auto close in 20 seconds..."
  )

Goto :EINDE


:EINDE



Kind regards,
Pieter





-----Original Message-----
From: Servers Alive Discussion List [mailto:[email protected]] On
Behalf Of Demeulemeester, Pieter
Sent: maandag 21 april 2014 19:01
To: Servers Alive Discussion List
Subject: RE: [SA-list] save/restore setup

Yes, I have a batch that makes an export of the registry and copy the
entries file, and some other files, into a ZIP file.
I'll send it tomorrow.  
 
 
Pieter 

________________________________

Van: Servers Alive Discussion List namens Ann Lynnworth
Verzonden: ma 21/04/2014 18:15
Aan: Servers Alive Discussion List
Onderwerp: [SA-list] save/restore setup



Is there any way to save (export, backup) the overall Servers Alive
"setup" to transfer to another machine?  Registry settings somewhere?
Files to transfer?

Thank you.

Ann

To unsubscribe send a message with UNSUBSCRIBE in the subject line to
[email protected]
If you use auto-responders (like out-of-the-office messages), make sure
that they are not sent to the list nor to individual members.  Doing so
will cause you to be automatically removed from the list.

To unsubscribe send a message with UNSUBSCRIBE in the subject line to
[email protected]
If you use auto-responders (like out-of-the-office messages), make sure
that they are not sent to the list nor to individual members.  Doing so
will cause you to be automatically removed from the list.

To unsubscribe send a message with UNSUBSCRIBE in the subject line to 
[email protected]
If you use auto-responders (like out-of-the-office messages), make sure that 
they are not sent to the list nor to individual members.  Doing so will cause 
you to be automatically removed from the list.

Reply via email to