Following is a great batch script that you can schedule to take backup of Datastore if you are using MS Access or MSDE as database.
It will backup C:\Program Files\Citrix\Independent Management Architectures and store it to C:\Backup_Datastore
It overwrites the previous backed up data.
To run the script copy the entire script and save it as .bat extension.
@echo off
REM ======================================================================
REM NAME : Citrix Backup
REM AUTHOR : Russell Pitcher, SAVVIS Inc
REM DATE : 13/02/2009
REM COMMENT: Backup of CTX Datastore - requires windows 2003 and sleep.exe
REM ======================================================================
set MESSAGE=The Citrix MetaFrame farm is going down for periodic maintenance. Please save your files, log out, and reconnect in one hour to continue working.
set IMAFOLDER=%PROGRAMFILES%\Citrix\Independent Management Architecture
set BACKUPFOLDER=C:\Backup_Datastore
echo Message = %MESSAGE%
echo IMA folder = %IMAFOLDER%
echo Backup folder = %BACKUPFOLDER%
REM goto :END
REM Warn users to log out and stop new logons
msg * %MESSAGE%
change logon /disable
echo.
echo Pausing for 30 seconds...
sleep 30
echo.
echo Stopping Citrix services
net stop ctxHttp
net stop MFCom
net stop "Citrix SMA Service"
net stop CitrixWMIService
net stop IMAService /y
echo.
echo Stopped Citrix services
echo.
echo Recreating Citrix LHC
"%PROGRAMFILES%\Citrix\system32\Citrix\IMA\DsMaint.exe" RecreateLhc
echo.
echo Pausing for 30 seconds...
sleep 30
REM Clear the backup folder, or create it if it does not exist
if exist "%BACKUPFOLDER%" (
echo.
echo Clearing backup folder
del "%BACKUPFOLDER%\*.*" /f /q
) else (
echo.
echo Backup folder missing. Logging event and recreating folder
md "%BACKUPFOLDER%"
EventCreate /l application /t warning /so SAVVIS /id 999 /d "The %BACKUPFOLDER% folder was missing. It has been recreated, but the security has been reset to 'Allow inheritable permissions'. Please verify the security settings."
)
echo.
echo Backing up the Citrix datastore
copy "%IMAFOLDER%\*.*" "%BACKUPFOLDER%"
echo.
echo Re-starting Citrix services
net start "Citrix SMA Service"
net start CitrixWMIService
net start IMAService
net start MFCom
net start ctxHttp
echo.
echo Re-enable new logons
change logon /enable
:END
echo.
echo == The End ==
echo.
It will backup C:\Program Files\Citrix\Independent Management Architectures and store it to C:\Backup_Datastore
It overwrites the previous backed up data.
To run the script copy the entire script and save it as .bat extension.
@echo off
REM ======================================================================
REM NAME : Citrix Backup
REM AUTHOR : Russell Pitcher, SAVVIS Inc
REM DATE : 13/02/2009
REM COMMENT: Backup of CTX Datastore - requires windows 2003 and sleep.exe
REM ======================================================================
set MESSAGE=The Citrix MetaFrame farm is going down for periodic maintenance. Please save your files, log out, and reconnect in one hour to continue working.
set IMAFOLDER=%PROGRAMFILES%\Citrix\Independent Management Architecture
set BACKUPFOLDER=C:\Backup_Datastore
echo Message = %MESSAGE%
echo IMA folder = %IMAFOLDER%
echo Backup folder = %BACKUPFOLDER%
REM goto :END
REM Warn users to log out and stop new logons
msg * %MESSAGE%
change logon /disable
echo.
echo Pausing for 30 seconds...
sleep 30
echo.
echo Stopping Citrix services
net stop ctxHttp
net stop MFCom
net stop "Citrix SMA Service"
net stop CitrixWMIService
net stop IMAService /y
echo.
echo Stopped Citrix services
echo.
echo Recreating Citrix LHC
"%PROGRAMFILES%\Citrix\system32\Citrix\IMA\DsMaint.exe" RecreateLhc
echo.
echo Pausing for 30 seconds...
sleep 30
REM Clear the backup folder, or create it if it does not exist
if exist "%BACKUPFOLDER%" (
echo.
echo Clearing backup folder
del "%BACKUPFOLDER%\*.*" /f /q
) else (
echo.
echo Backup folder missing. Logging event and recreating folder
md "%BACKUPFOLDER%"
EventCreate /l application /t warning /so SAVVIS /id 999 /d "The %BACKUPFOLDER% folder was missing. It has been recreated, but the security has been reset to 'Allow inheritable permissions'. Please verify the security settings."
)
echo.
echo Backing up the Citrix datastore
copy "%IMAFOLDER%\*.*" "%BACKUPFOLDER%"
echo.
echo Re-starting Citrix services
net start "Citrix SMA Service"
net start CitrixWMIService
net start IMAService
net start MFCom
net start ctxHttp
echo.
echo Re-enable new logons
change logon /enable
:END
echo.
echo == The End ==
echo.
No comments:
Post a Comment