Thursday, April 19, 2018

Saving FIM / MIM configuration

Just a quick note with a small Powershell script that I made to export configuration for the Synchronization Engine. I use this script on and off at customers to make sure that we can get back to a former state - or move existing configuration from environment to environment when building.

Feel free to use and modify

param
(
    $miispath = 'C:\Program Files\Microsoft Forefront Identity Manager\2010\Synchronization Service\Bin\',
    $maexport = ( join-path $miispath 'maexport.exe' ),
    $svrexport = ( join-path $miispath 'svrexport.exe' ),
    $managementagents = ('ad', 'crm-emp','crm-emp-ad','db-member','crm-member', 'sp-profile'),
    $exportdir = 'export-config'
)
$date = (get-date).tostring('yyyy-MM-dd')

# create base folders with current date
$madir = join-path (join-path (join-path . $exportdir ) $date) 'ma'
write-debug $madir
$null = new-item -path $madir -type directory -force

$svrdir = join-path (join-path (join-path . $exportdir ) $date) 'svrexport'
write-debug $svrdir
$null = new-item -path $svrdir -type directory -force

foreach ($ma in $managementagents)
{
    $null = new-item -path test -type directory -force
    & $maexport $ma (join-path $madir "$($ma).xml")
}

& $svrexport $svrdir


Thanks,
Soren