In Part II I will cover how to do all of it in a single script
I am going to start off with and then customize a script from http://social.technet.microsoft.com/Forums/en-CA/Forefrontedgegeneral/thread/4e6a148e-8c69-4023-a282-15dcfede3900 posted by Jason Jones
This script will export the EMS enterprise configuration as well as three arrays. You will need to change the script to reflect your environment. Only change the text in orange, leave all quotation marks in place.
' TMG Enterprise and Array Configuration Backup Script ' ' Original http://social.technet.microsoft.com/Forums/en-CA/Forefrontedgegeneral/thread/4e6a148e-8c69-4023-a282-15dcfede3900 ' ' Changed by Etienne Liebetrau - http://fixmyitsystem.com ' ' ------------------------------------------------------------- ' ' Specify the array firendly names ArrayName1 = "Array names as listed in console" ArrayName2 = "Array names as listed in console" ArrayName3 = "Array names as listed in console" 'Export strings password = "mypassword" comment = """Scripted Backup""" 'Backup location can be local or network location BackupLocation = "\\networkname\Share\" '--------------- No changes required beyond this line ------------ Dim root Dim isaEnterprise Dim isaArray1 Dim isaArray2 Dim isaArray3 localdate = FormatDateTime(date(), 1) 'Displays according to the system long date format Datestring = " " & localdate Set root = CreateObject("FPC.Root") Set isaEnterprise = root.Enterprise Set isaArray1 = root.Arrays.Item(ArrayName1) Set isaArray2 = root.Arrays.Item(ArrayName2) Set isaArray3 = root.Arrays.Item(ArrayName3) Wscript.echo "Saving Configurations to " & BackupLocation & "...." wscript.echo "Exporting - Enterprise Configuration" isaEnterprise.ExportToFile BackupLocation & "Enterprise Config" & Datestring & ".xml", 15, password, comment wscript.echo "Exporting - " & ArrayName1 isaArray1.ExportToFile BackupLocation & ArrayName1 & Datestring &".xml", 15, password, comment wscript.echo "Exporting - " & ArrayName2 isaArray2.ExportToFile BackupLocation & ArrayName2 & Datestring &".xml", 15, password, comment wscript.echo "Exporting - " & ArrayName3 isaArray3.ExportToFile BackupLocation & ArrayName3 & Datestring &".xml", 15, password, comment Wscript.echo "Exporting Completed"
The script is fairly simple so adding or removing arrays is not too complicated.
The script will output 4 files. One for the enterprise configuration and three for the arrays. To restore the export you would right click at the relevant enterprise or array level and select Import (Restore)
You might also want to purge files older than a certain age to ensure you don't keep unnecessary files. There is a script and instruction on http://fixmyitsystem.com/2011/05/automatically-purge-old-files-and.html
** Update **
Thanks to Richard Hicks I have made some changes to the script. It will now backup the enterprise configuration and automatically retrieve the names of and export the configuration of every array in the enterprise.
Thanks everyone for all the help!
** Update **
Thanks to Richard Hicks I have made some changes to the script. It will now backup the enterprise configuration and automatically retrieve the names of and export the configuration of every array in the enterprise.
' TMG Enterprise and Array Configuration Backup
Script
'
' Etienne Liebetrau - http://fixmyitsystem.com
'
'
-------------------------------------------------------------
'
'Export strings
password = "mypassword"
comment = """Scripted
Backup"""
'Backup location can be
local or network location
BackupLocation = "\\networkname\share"
'--------------- No
changes required beyond this line ------------
Dim root
Dim isaEnterprise
Dim Array
localdate =
FormatDateTime(date(), 1) 'Displays according to the system long date format
Datestring = "
" & localdate
Set root =
CreateObject("FPC.Root")
Set isaEnterprise =
root.Enterprise
'Backing Enterprise
Config
Wscript.echo
"Saving Configurations to " & BackupLocation &
"...."
wscript.echo
"Exporting - Entertprise Configuration"
isaEnterprise.ExportToFile BackupLocation &
"Enterprise Config" & Datestring & ".xml", 15,
password, comment
'Backing Up arrays
For Each Array in
Root.Arrays
wscript.echo
"Exporting - " & Array
Array.ExportToFile
BackupLocation & Array & Datestring &".xml", 15,
password, comment
Next
Wscript.echo
"Exporting Completed"
Thanks everyone for all the help!


2 comments:
Hi Eitenne,
To make the script more flexible you can add some logic that will parse the enterprise for each array, then execute the backup for those arrays as necessary. For example:
For Each Array in Root.Arrays
Array.ExportToFile ...
Next
Thanks!
Hi Richard
I have updated the article with the suggested improvement.
Et
Post a Comment