Share via


How to Use PowerShell to Display the Export State of a Management Agent

FIM ScriptBox Item

Summary

The script code below displays the pending exports for a management agent.
You can use this script to troubleshoot export related issues.

 

Script Code

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
#-------------------------------------------------------------------------------------------------------------
 if($args.count -ne 1) {throw "Missing parameter "}
 $maName = $args[0]
#-------------------------------------------------------------------------------------------------------------
 $lstMA = @(get-wmiobject -class "MIIS_ManagementAgent" -namespace "root\MicrosoftIdentityIntegrationServer"`
                          -computername "." -filter "Name='$maName'") 
 if($lstMA.count -eq 0) {throw "MA not found"}
#-------------------------------------------------------------------------------------------------------------
 write-host "`nPending Exports For Management Agent"
 write-host "===================================="
 write-host "Name : $maName"
 write-host "Update : $($lstMA[0].NumExportUpdate().ReturnValue)"
 write-host "Add : $($lstMA[0].NumExportAdd().ReturnValue)"
 write-host "Delete : $($lstMA[0].NumExportDelete().ReturnValue)`n"
#-------------------------------------------------------------------------------------------------------------
 trap  
 { 
    Write-Host "`nError: $($_.Exception.Message)" -foregroundcolor white -backgroundcolor darkred 
    Exit
 }
#-------------------------------------------------------------------------------------------------------------

 

Note

To provide feedback about this script, create a post on the FIM TechNet Forum.
For more FIM related Windows PowerShell scripts, see the FIM ScriptBox.