|
Andy_UK -> RE: Automate Backup to XML?? (26.May2006 3:17:00 PM)
|
Hi All, I have managed to incoropate a couple of changes to the vbs. I will paste it below, it works OK on my ISA, although you should clearly test this for yourselves. You will need to replace SETTHISVALUE in the vbs with your own details. When you run the vbs from the command line, if you just add an e after it, it will export the config to the folder you specify in the vbs (one of the SETTHISVALUE values) and then email you to let you know it has finished. There are no prompt or message boxes making this easier to schedule in windows scheduler. When you run the VBS from the command line with an i, it will prompt for the full folder and file name to import. This still puts a message onscreen to let you know it is running and when it has finished. The only thing I have found so far, is that when you import a file, it seems to add duplicate entries for management computers. The file contents are below. As I say PLEASE make sure you are happy with this before relying on it. Mods, I am not sure if posting scripts is a problem, if it is then please accept my apologies and remove from the thread. Thanks Andy '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' This script exports the configuration of the array object of an ISA Server ' computer to a specified XML file or imports the configuration in a specified ' XML file to array object of the ISA Server computer. ' The following parameter must be included on the command line: ' 1. The letter "e" or "i" to indicate whether the configuration will be ' exported or imported. ' When e is selected, script will export to file and location specified and then ' email to the specified address. ' When i is selected, a prompt box will appar asking for full path and filename ' to import, a message will be displayed when selection has been made and when ' import is complete. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub ImportExport() ' Define a constant to indicate that no optional data will ' be exported or imported. const noOptionalData = 0 'Declare the objects needed Dim root ' The FPCLib.FPC root object Dim firewall ' An FPCArray object Dim strComputer ' Create the root obect. Set root = CreateObject("FPC.Root") ' Get a reference to the array object (firewall). Set firewall = root.GetContainingArray If WScript.Arguments(0) = "e" Then ' Export the configuration to the XML file. ' Notice that values are not specified for the optional parameters. firewall.ExportToFile "C:\SETTHISVALUE\"& replace(Date,"/","_")+"_ISA_CONFIG.XML", noOptionalData Set objMessage = CreateObject("CDO.Message") objMessage.Subject = "SETTHISVALUE" objMessage.From = "SETTHISVALUE" objMessage.To = "SETTHISVALUE" objMessage.TextBody = "SETTHISVALUE" '==This section provides the configuration information for the remote SMTP server. '==Normally you will only change the server name or IP. objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Name or IP of Remote SMTP Server objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "SETTHISVALUE" 'Server port (typically 25) objMessage.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 objMessage.Configuration.Fields.Update '==End remote SMTP server configuration section== objMessage.Send WScript.Quit End If If WScript.Arguments(0) = "i" Then Do strfileloc = (InputBox(" Location and Filename to Import", "File to Import")) If strfileloc <> "" Then strInput = True End if Loop until strInput = True WScript.Echo "Importing the configuration from " & strfileloc & " to the " & firewall.Name & " array object, a message will appear when complete" ' Import the firewall's configuration from the XML file specified. ' Notice that values are not specified for some of the optional parameters. firewall.ImportFromFile strfileloc,noOptionalData,,,True WScript.Echo "Importing was completed successfully." End If End Sub ImportExport
|
|
|
|