none
Automate Forefront TMG 2010 Config Backup

    Question

  • Hi,

    We have recently installed a Forefront TMG 2010 server and I am really surprised that there is no way to backup the Firewall / System config automatically unless I am totally missing something.

    I have done some various Google searches but most script solutions I find relate to ISA2006 and dont work on TMG.

    I have read also that if you do VSSAdmin List Writers there is a ISA Server Writer... So therefore is it possible to simply do a System State backup and this includes the config? Problem is I want to be able to restore only the XML config if an issue occurs.

    So I suppose the main question here is does anyone have a solution to export the configs from command line or power shell?

    Thanks

    J

    Wednesday, July 21, 2010 9:08 AM

Answers

  • Ok, managed to figure this out and it was me being a bit silly and not fully understanding the script.

    From a command prompt I ran the following:

    C:\>ImportExport.vbs e backup.xml

    This then created the the XML file backup with no issues. As you can see it did not work using the "e" as an argument.

    So this worked for me on the export but I had some really anoying popup messages in the script which means you has to click on Ok to continue with the backup. Therefore I simply edited the script and removed the following two lines:

    WScript.Echo "Exporting the configuration of the " & firewall.Name & " array object to " & WScript.Arguments(1) & " ..

    WScript.Echo "Exporting was completed successfully."

    This now meant when running the script from a batch file I had no popup messages and it completely automated the TMG backup to the XML file.

    I hope others find this useful as took me long enough to spot my error.

    J

    • Marked as answer by PT_J Friday, July 30, 2010 3:30 PM
    Friday, July 30, 2010 3:29 PM

All replies

  • Hi,

     

    Thank you for the post.

     

    For ISA 2006, please refer to: http://www.isaserver.org/tutorials/ISA-Server-2006-Backup-Restore-Capabilities.html

    For Forefront TMG, please refer to: http://msdn.microsoft.com/en-us/library/dd435786.aspx

     

    Regards,


    Nick Gu - MSFT
    Thursday, July 22, 2010 7:34 AM
    Moderator
  • Hi,

    Not sure if I am totally missing something here but I am using the ImportExport example from the TMG link above, however it is not working.

    I have saved the code in notepad and then renamed it to ImportExport.vbs and placed this in the root of C:\

    When I run ImportExport.vbs -e "C:\configbackup.xml" from a command prompt I get no errors and no config file being created.

    Am I missing something?

    Thanks

    J

    • Edited by PT_J Thursday, July 22, 2010 8:01 AM Spelling
    Thursday, July 22, 2010 8:00 AM
  • Hi,

     

    Thank you for the update.

     

    You may also download ImportExport script sample in Forefront TMG Software Development Kit (SDK) and double click it to see if helps.

     

    Forefront Threat Management Gateway (TMG) 2010 Tools & Software Development Kit

    http://www.microsoft.com/downloads/details.aspx?FamilyID=8809cfda-2ee1-4e67-b993-6f9a20e08607&displaylang=en

     

    Regards,


    Nick Gu - MSFT
    Tuesday, July 27, 2010 4:28 AM
    Moderator
  • Thank Nick,

    Downloaded the SDK and double clicked the ImportExport vbs script. I got the following error:

    Error: Invalid number of parameters. Syntax: ImportExport {e | i} filename

    I also tried running the following:

    C:\>ImportExport.vbs -e "c:\config.xml"

    Question is have I got the wrong syntax I am running from command prompt? Cannot find any examples of what to run anywhere...

    Thanks

    J

    Tuesday, July 27, 2010 7:53 AM
  • Just wondering if anyone has ever managed to get this script to work? I am sure I am doing something wrong but can find no documentation on how to get this working...

    Friday, July 30, 2010 2:40 PM
  • Ok, managed to figure this out and it was me being a bit silly and not fully understanding the script.

    From a command prompt I ran the following:

    C:\>ImportExport.vbs e backup.xml

    This then created the the XML file backup with no issues. As you can see it did not work using the "e" as an argument.

    So this worked for me on the export but I had some really anoying popup messages in the script which means you has to click on Ok to continue with the backup. Therefore I simply edited the script and removed the following two lines:

    WScript.Echo "Exporting the configuration of the " & firewall.Name & " array object to " & WScript.Arguments(1) & " ..

    WScript.Echo "Exporting was completed successfully."

    This now meant when running the script from a batch file I had no popup messages and it completely automated the TMG backup to the XML file.

    I hope others find this useful as took me long enough to spot my error.

    J

    • Marked as answer by PT_J Friday, July 30, 2010 3:30 PM
    Friday, July 30, 2010 3:29 PM
  • I know this is a reply to an old thread, but just for reference:

    the annoying popups you mention are coming from the script host that you are using.

    since you don't use the script host, but call the ImportExport.vbs script directly, windows uses the default: windows script host. that will give you the popups.

    If you use:

    cscript ImportExport.vbs e backup.xml

    The output will come in your command prompt without popup, allowing you not only to run the script from batch without popups, but also to save this output in a log file.


    BvZanten

    Wednesday, November 14, 2012 12:03 PM
  • I've modded this script a bit to make it more useful for automating backups.

    http://pastebin.com/86zPGEbY

    Now you just setup a Scheduled Task calling cscript with the parameters C:\path-to-the-script\Export-Configuration.vbs C:\backup-path

    C:\ is not required. The destination can be a UNC path.

    The script creates a file in C:\backup-path named TMGServerHostname_2013-4-5_15.49.41.xml

    So it has the server hostname, year, month, date, hour, minute and second

    I think the only part now would be to delete files in that directory that are older than some period of time, so you're not storing this crap forever. Right now my backups are 7MB, so even daily backups over 5 years is less than 20GB. I don't plan on leaving it that way forever, but inthe event you set this script up and forget about it, it'll be a while before you run out of disk space.

    Hope someone else finds that helpful.



    • Edited by nf_ Monday, April 08, 2013 4:37 PM
    Friday, April 05, 2013 11:30 PM