jmbrinkman

Posts Tagged ‘ISA’

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”

$root.Exporttofile(“[PATH_AND_Filename]”,”0″)

If you have an standalone array use this instead:

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

$array=$root.GetContainingArray()

$array.Exporttofile(“[PATH_AND_Filename]”,”0″)

To give an example, this what a typical script to backup TMG will look like:
$array=$root.GetContainingArray()
$array.exporttofile(“d:\tmgbackup.xml”,”0″)
if ($err)
    {
    write-eventlog -logname Application -source TMGBackup -eventid 9999 -entrytype Warning -message “Backup
failed, cause: $err” -category 0
    }
else
{
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.

Advertisements