RSS .92| RSS 2.0| ATOM 0.3
  • Home
  • About
  •  

    Backup eXc Virtual Agent Config

    I work in an environment that is over 90% virtualized on VMWare and to aid in monitoring that environment via OpsMgr 2007, I use Quest Management Xtensions (formerly eXc Virtual Agent). I have not yet had a chance to work with the recently released Operations Manager 2007 Cross Platform Extensions Beta. The Quest product is completely configurable (aside from the base framework) because everything is written in scripting language making calls to the VMWare and Linux kernels via WMI and SNMP and all the configuration files are stored in XML. The developers support custom changes to the script source code and even welcome submission of new ideas/techniques.

    While this makes the software very flexible, it also leaves room to mess things up which I have done a couple of times in the past while learning my way around. I also blew away my configs when I updated to the latest base framework a few months ago because I didn’t have the XML backed up. To prevent this in the future, I wrote a very simple, old-school backup process which captures the configuration files as well as the encrypted password files.

    This process runs on a central server that I use for automating and scheduling custom enterprise scripts and tasks. It consists of two simple files; a command batch script and a simple vbscript listed below. In addition, it requires that 7-zip be installed where the scripts will be run as it is used to compress the configuration files into a single archive.

    @echo off
    REM ======================================================================
    REM
    REM NAME: Backup_eXc_Config.cmd
    REM
    REM AUTHOR: Alan
    REM DATE  : 5/27/2008
    REM
    REM COMMENT: Backs up eXc config settings for XML and encrypted passwords.
    REM
    REM REQUIREMENTS:
    REM     1. 7-Zip must be installed to default location (www.7-Zip.com)
    REM     2. The DeleteFilesGT30Days.vbs script must be in same directory.
    REM ======================================================================
    
    REM SERVER01
    REM Get Date.
    set datestring=%date%
    
    REM Replace forward slashes with underscores.
    set datestring=SERVER01_%datestring:/=_%.zip
    
    REM Replace day with nothing so only date is left.
    set datestring=%datestring:Sun =%
    set datestring=%datestring:Mon =%
    set datestring=%datestring:Tue =%
    set datestring=%datestring:Wed =%
    set datestring=%datestring:Thu =%
    set datestring=%datestring:Fri =%
    set datestring=%datestring:Sat =%
    
    REM Change dir to 7-Zip and compress
    cd "C:\Program Files\7-Zip"
    7z.exe a -tzip "C:\Scripts\Batch\eXcBackup\"%datestring% "<a href="file://\\SERVER01\c$\Program">\\SERVER01\c$\Program</a> Files\eXc Software\WMI Providers\nonWindows\Virtual Agent Library\mom\VMWare" -r -x!*.log* -x!*.mdb -x!*.ldb -aoa
    7z.exe u "C:\Scripts\Batch\eXcBackup\"%datestring% "<a href="file://\\SERVER01\c$\Program">\\SERVER01\c$\Program</a> Files\eXc Software\WMI Providers\nonWindows\Encryption" *.txt
    
    REM Call script to delete old archives.
    cscript //nologo "C:\Scripts\Batch\eXcBackup\DeleteFilesGT30Days.vbs"
    '==========================================================================
    '
    ' NAME: DeleteFilesGT30Days.vbs
    '
    ' AUTHOR: Alan
    ' DATE  : 5/27/2008
    '
    ' COMMENT: Deletes .zip files in current directory older than 30 days.
    '
    '==========================================================================
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
        &amp; "{impersonationLevel=impersonate}!\\" &amp; _
            strComputer &amp; "\root\cimv2")
    Set colFiles = objWMIService.ExecQuery _
        ("Select * from CIM_DataFile where Path = '\\Scripts\\Batch\\eXcBackup\\'")
    For Each objFile in colFiles
        If InStr(objFile.Name, ".zip") Then
            Set objZipFile = objFSO.Getfile(objFile.Name)
            If objZipFile.DateCreated &lt; (Now - 30) Then
             objZipFile.Delete
         End If
        End If
    Next

    Leave a Reply