Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' Copyright (c) Microsoft Corporation. All rights reserved.
- ' THIS CODE IS MADE AVAILABLE AS IS, WITHOUT WARRANTY OF ANY KIND. THE ENTIRE
- ' RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS CODE REMAINS WITH THE
- ' USER. USE AND REDISTRIBUTION OF THIS CODE, WITH OR WITHOUT MODIFICATION, IS
- ' HEREBY PERMITTED.
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' This script exports the configuration of the array object of an TMG Server
- ' computer to a specified XML file or imports the configuration in a specified
- ' XML file to array object of the TMG Server computer.
- ' The following two parameters must be included on the command line:
- ' 1. The letter "e" or "i" to indicate whether the configuration will be
- ' exported or imported.
- ' 2. The name of the XML file.
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' 2013-04-05 this is based on ImportExport.vbs in the TMG 2010 SDK (TMGSDK.exe)
- ' check the samples/Admin/ImportExport.cvs for the original
- ' I've removed the import function, made it only ask for a directory
- ' -nf
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- Sub ExportTMGConfiguration()
- ' Define a constant to indicate that no optional data will
- ' be exported or imported.
- const noOptionalData = 0
- If WScript.Arguments.Count <> 1 Then
- WScript.Echo "Error: Invalid number of parameters." & vbCrLf & _
- "Syntax:" & vbCrLf & _
- "ImportExport path-for-backups"
- Exit Sub
- End If
- 'Declare the objects needed
- Dim root ' The FPCLib.FPC root object
- Dim firewall ' An FPCArray object
- Dim backup_filename ' file that we're backing up to...
- ' Create the root obect.
- Set root = CreateObject("FPC.Root")
- ' Get a reference to the array object (firewall).
- Set firewall = root.GetContainingArray
- ' Set the backup filename
- backup_filename = WScript.Arguments(0) & "\" & firewall.Name & "_" & Year(Now) & "-" & Month(Now) & "-" & Day(Now) & "_" & Hour(Now) & "." & Minute(Now) & "." & Second(Now) & ".xml"
- WScript.Echo "Exporting the configuration of the " & firewall.Name & " array object to " & backup_filename & " ..."
- ' Export the configuration to the XML file.
- ' Notice that values are not specified for the optional parameters.
- firewall.ExportToFile backup_filename, noOptionalData
- WScript.Echo "Exporting was completed successfully."
- WScript.Quit
- End Sub
- ExportTMGConfiguration
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement