Backup TMG configuration using Powershell

In Powershell on September 23, 2011 at 13:08

Unfortunatly TMG doesn’t ship with any specific Powershell cmdlets. However, using COM objects you can export/backup up the TMG (or ISA) configuration to a xml file.

Depending on your environment there are two options, if you have an Enterprise Array use this:

$root= New-Object -ComObject “FPC.Root”


If you have an standalone array use this instead:

$root= New-Object -ComObject “FPC.Root



To give an example, this what a typical script to backup TMG will look like:
if ($err)
    write-eventlog -logname Application -source TMGBackup -eventid 9999 -entrytype Warning -message “Backup
failed, cause: $err” -category 0
write-eventlog -logname Application -source TMGBackup -eventid 9000 -entrytype Information -message “Backup Succeeded” -category 0

You should of course first register the eventlog source using new-eventlog to register the TMGBackup eventlog source.

  1. Hi Michiel,

    Thanks for the script! Only I have one (script-noob) question: when I do a manual export of the data, the file is larger than the one created by the script. When I do a manual export and include the confidential and user info, it becomes larger still. Do you know why this is, and is there a way to automatically create a full backup including the confidential and user information that is equal in size?

    Regards, Meindert

    • Hi,

      First of all the difference is size seems to be caused by the fact that the script only exports the array configuration and not the server configuration. You can see that by checking the xml output from the script – it doesn’t contain the elements. So basically only the array specific bits are exported.

      I’ll test a restore to see what the impact of that is and then I’ll dig into the object model so see if I can export the server info and the confidential stuff as well. I’ll post my findings somewhere this week.

  2. […] time ago I posted a script to backup the TMG configuration using Powershell. Meindert Honig tested my script and gave me some […]

  3. Spot on with this write-up, I actually believe this amazing site needs a great deal more attention.

    I’ll probably be returning to see more, thanks for the advice!

  4. My coder is trying to persuade me to move to .
    net from PHP. I have always disliked the idea because of
    the expenses. But he’s tryiong none the less. I’ve been using
    WordPress on various websites for about a year and am concerned about switching to another platform.
    I have heard very good things about blogengine.
    net. Is there a way I can transfer all my wordpress content into it?
    Any help would be greatly appreciated!

  5. If you are looking for fantastic dumbbell workouts for men, then you have come to the right place.
    If you have the equipment and someone to teach you proper
    form, the Olympic lifts (the snatch and the clean and jerk) can be great additions to
    a weight lifting routine. For the chest for instance you can focus on ball push ups which also work the shoulders, and triecps.

  6. Hi there, just became aware of your blog through Google, and found that it’s really informative.

    I am going to watch out for brussels. I’ll be grateful if you continue this in future.

    A lot of people will be benefited from your writing. Cheers!

  7. Ahaa, its good dialogue about this piece of writing here
    at this web site, I have read all that, so at this time me also commenting

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: