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 rootMicrosoftIdentityIntegrationServer
$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 rootMicrosoftIdentityintegrationServer -Filter $GetRunStartTime |
How to get a single run’s details |
$RunDetailInfo = $GetNamespace[1].RunDetails().ReturnValue
$RunDetailInfo |
Returned Information ma-id : {E7C9572C-3EE0-4DAF-BBFD-1B9015D2E749} ma-name : ALPINESKI08 run-number : 2 run-profile-name : Full Import (Stage Only) security-id : ADVENTUREWORKSAdministrator step-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 Information step-number : 1 step-id : {53535F51-CA5F-491F-8A96-82708A4E444B} start-date : 2016-07-13 01:14:01.217 end-date : 2016-07-13 01:14:36.290 step-result : success step-description : step-description current-export-step-counter : 0 last-successful-export-step-counter : 0 ma-connection : ma-connection ma-discovery-errors : ma-discovery-counters : ma-discovery-counters synchronization-errors : mv-retry-errors : staging-counters : staging-counters inbound-flow-counters : inbound-flow-counters export-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 Information disconnector-filtered : disconnector-filtered disconnector-joined-no-flow : disconnector-joined-no-flow disconnector-joined-flow : disconnector-joined-flow disconnector-joined-remove-mv : disconnector-joined-remove-mv disconnector-projected-no-flow : disconnector-projected-no-flow disconnector-projected-flow : disconnector-projected-flow disconnector-projected-remove-mv : disconnector-projected-remove-mv disconnector-remains : disconnector-remains connector-filtered-remove-mv : connector-filtered-remove-mv connector-filtered-leave-mv : connector-filtered-leave-mv connector-flow : connector-flow connector-flow-remove-mv : connector-flow-remove-mv connector-no-flow : connector-no-flow connector-delete-remove-mv : connector-delete-remove-mv connector-delete-leave-mv : connector-delete-leave-mv connector-delete-add-processed : connector-delete-add-processed flow-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 rootMicrosoftIdentityIntegrationServer -Filter $GetSyncError $GetCSNamespace |
Additional Resources
- MIIS_CSObject: https://msdn.microsoft.com/en-us/library/windows/desktop/ms697741(v=vs.100).aspx
- MIIS_RunHistory: https://msdn.microsoft.com/en-us/library/windows/desktop/ms697834(v=vs.100).aspx
- MIIS WMI Classes: https://msdn.microsoft.com/en-us/library/windows/desktop/ms698311(v=vs.100).aspx