Support-Info: (RUN HISTORY): How to use the MIIS_RunHistory WMI Class
PURPOSE
The purpose of this article is to provide an illustration of how to utilize the WMI Namespace Provider, MicrosoftIdentityIntegrationServer, to pull information about the Run History (Operations Tab). Through the MIIS_RunHistory class, we can gather information about each run. For successful objects, we can only grab numbers. If there is a synchronization error, we can grab more information.
Here is some illustrations of using PowerShell with the WMI class MIIS_RunHistory.
How to get a count of the number of runs on the Operations Tab |
$GetNamespace = Get-WmiObject -Class "MIIS_RunHistory" -Namespace root\MicrosoftIdentityIntegrationServer$RunHistoryCount=$GetNamespace.Count$RunHistoryCount |
How to get Run History data based on a date range |
$RunStartDate=(Get-Date (Get-Date).AddDays(-2) -Format d)$GetRunStartTime="RunStartTime >'"+$RunStartDate+"'"$GetRunHistoryNotSuccess = Get-WmiObject -class "MIIS_RunHistory" -namespace root\MicrosoftIdentityintegrationServer -Filter $GetRunStartTime |
How to get a single run’s details |
$RunDetailInfo = $GetNamespace[1].RunDetails().ReturnValue$RunDetailInfo |
Returned Informationma-id : {E7C9572C-3EE0-4DAF-BBFD-1B9015D2E749}ma-name : ALPINESKI08run-number : 2run-profile-name : Full Import (Stage Only)security-id : ADVENTUREWORKS\Administratorstep-details : step-details |
How to get step details of a single run |
[xml]$xmlDetails = $GetNamespace[1].RunDetails().ReturnValue$RunDetalsInfo = $xmlDetails.DocumentElement["run-details"]$StepDetails = $RunDetalsInfo["step-details"]$StepDetails |
Returned Informationstep-number : 1step-id : {53535F51-CA5F-491F-8A96-82708A4E444B}start-date : 2016-07-13 01:14:01.217end-date : 2016-07-13 01:14:36.290step-result : successstep-description : step-descriptioncurrent-export-step-counter : 0last-successful-export-step-counter : 0ma-connection : ma-connectionma-discovery-errors :ma-discovery-counters : ma-discovery-counterssynchronization-errors :mv-retry-errors :staging-counters : staging-countersinbound-flow-counters : inbound-flow-countersexport-counters : export-counters |
How to get the status of a single run |
$RunStatusInfo = $GetNamespace[1].RunStatus$RunStatusInfo |
How to get the Run Profile that was executed with the status of that run |
$RunProfileName = $GetNamespace[1].RunProfile.ToString()$RunStatusInfo = $GetNamespace[1].RunStatus$RunProfileName+"-"+$RunStatusInfo |
How to dig into the Run Details via XML |
[xml]$xmlDetails = $GetNamespace[1].RunDetails().ReturnValue$RunDetalsInfo = $xmlDetails.DocumentElement["run-details"]$StepDetails = $RunDetalsInfo["step-details"]$RunDetalsInfo$StepDescription = $StepDetails["step-description"]$StepDetails$StepDescription |
How to get the partition information on a single run |
[xml]$xmlDetails = $GetNamespace[1].RunDetails().ReturnValue$RunDetalsInfo = $xmlDetails.DocumentElement["run-details"]$StepDetails = $RunDetalsInfo["step-details"]$StepDescription = $StepDetails["step-description"]$GetPartitionInfo = $StepDescription["partition"]$GetPartitionInfo |
How to get the step data of a single run |
[xml]$xmlDetails = $GetNamespace[1].RunDetails().ReturnValue$RunDetalsInfo = $xmlDetails.DocumentElement["run-details"]$StepDetails = $RunDetalsInfo["step-details"]$StepDescription = $StepDetails["step-description"]$GetCustomData = $StepDescription["custom-data"]$GetStepData = $GetCustomData["adma-step-data"]$GetStepData |
How to get Synchronization information ( this is focused on import flow / inbound synchronization ) |
[xml]$xmlDetails = $GetNamespace[1].RunDetails().ReturnValue$RunDetalsInfo = $xmlDetails.DocumentElement["run-details"]$StepDetails = $RunDetalsInfo["step-details"]$GetInboundCounterInfo = $StepDetails["inbound-flow-counters"]$GetInboundCounterInfo |
Returned Informationdisconnector-filtered : disconnector-filtereddisconnector-joined-no-flow : disconnector-joined-no-flowdisconnector-joined-flow : disconnector-joined-flowdisconnector-joined-remove-mv : disconnector-joined-remove-mvdisconnector-projected-no-flow : disconnector-projected-no-flowdisconnector-projected-flow : disconnector-projected-flowdisconnector-projected-remove-mv : disconnector-projected-remove-mvdisconnector-remains : disconnector-remainsconnector-filtered-remove-mv : connector-filtered-remove-mvconnector-filtered-leave-mv : connector-filtered-leave-mvconnector-flow : connector-flowconnector-flow-remove-mv : connector-flow-remove-mvconnector-no-flow : connector-no-flowconnector-delete-remove-mv : connector-delete-remove-mvconnector-delete-leave-mv : connector-delete-leave-mvconnector-delete-add-processed : connector-delete-add-processedflow-failure : flow-failure |
How to get information on imports (Adds, Deletes, Updates) |
[xml]$xmlDetails = $GetNamespace[1].RunDetails().ReturnValue$RunDetalsInfo = $xmlDetails.DocumentElement["run-details"]$StepDetails = $RunDetalsInfo["step-details"]$GetNumberOfAddsOnImport = $StepDetails["staging-counters"].'stage-add'$GetNumberOfDeletesOnImport = $StepDetails["staging-counters"].'stage-delete'$GetNumberofUpdatesOnImport = $StepDetails["staging-counters"].'stage-update'$GetNumberOfAddsOnImport$GetNumberOfDeletesOnImport |
How to get the hologram of an object that through a synchronization error |
[xml]$xmlDetails = $GetNamespace[0].RunDetails().ReturnValue$RunDetalsInfo = $xmlDetails.DocumentElement["run-details"]$StepDetails = $RunDetalsInfo["step-details"].'synchronization-errors'.'import-error'$StepDetails$GetSyncError = $StepDetails[0].'cs-guid'$GetSyncError = "GUID='"+$GetSyncError+"'" $GetCSNamespace = Get-WmiObject -Class "MIIS_CSObject" -Namespace root\MicrosoftIdentityIntegrationServer -Filter $GetSyncError$GetCSNamespace |
Additional Resources