Skip to content

Instantly share code, notes, and snippets.

@jkbryan
Created October 2, 2018 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkbryan/b9b3bbea3d6a9cb1135f1f07671e8af3 to your computer and use it in GitHub Desktop.
Save jkbryan/b9b3bbea3d6a9cb1135f1f07671e8af3 to your computer and use it in GitHub Desktop.
export-policy.ps1
if(@(get-pssnapin | where-object {$_.Name -eq "FIMAutomation"} ).count -eq 0) {add-pssnapin FIMAutomation}
$workDir = "C:\FIMConfig\Temp\"
$policy_filename = $workDir+"FIM-Policy.xml"
Write-Host "Exporting configuration objects from pilot."
# In many production environments, some Set resources are larger than the default message size of 10 MB.
$policy = Export-FIMConfig -policyConfig -portalConfig -MessageSize 9999999
if ($policy -eq $null)
{
Write-Host "Export did not successfully retrieve configuration from FIM. Please review any error messages and ensure that the arguments to Export-FIMConfig are correct."
}
else
{
Write-Host "Exported " $policy.Count " objects from pilot."
$policy | ConvertFrom-FIMResource -file $policy_filename
Write-Host "Pilot file is saved as " $policy_filename "."
if($policy.Count -gt 0)
{
Write-Host "Export complete."
}
else
{
Write-Host "While export completed, there were no resources. Please ensure that the arguments to Export-FIMConfig are correct."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment