次の方法で共有


[SUPPORT TIP]: How to get Sync Statistics using WMI

 

All,

Hello.  I am writing today to illustrate how you can utilize WMI and PowerShell to grab the statistical information from Tools > Statistics and dump it to a CSV file.

$GetManagementAgents = Get-WmiObject -Class "MIIS_ManagementAgent" -Namespace root\MicrosoftIdentityintegrationServer
$GetMACount = $GetManagementAgents.Count
$FileSyncStats = $env:TEMP+"\SyncStats.CSV"
if ( Test-Path $FileSyncStats ){ [System.IO.File]::Delete($FileSyncStats) } ## If the Statisics File exists delete it

$HEADER_MAStats="MANAGEMENT AGENT NAME"+"`tMANAGEMENT AGENT GUID"+"`tMANAGEMENT AGENT TYPE"+"`tNUMBER OF CONNECTORS"+"`tNUMBER OF CS OBJECTS"+"`tNUMBER OF DISCONNECTORS"+"`tNUMBER OF EXPLICIT CONNECTORS"+"`tNUMBER OF EXPLICIT DISCONNECTORS"+"`tNUMBER OF EXPORT ADD"+"`tNUMBER OF EXPORT DELETE"+"`tNUMBER OF EXPORT UPDATE"+"`tNUMBER OF FILTERED DISCONNECTORS"+"`tNUMBER OF IMPORT ADD"+"`tNUMBER OF IMPORT DELETE"+"`tNUMBER OF PLACEHOLDERS"+"`tNUMBER OF TOTAL CONNECTORS"+"`tNUMBER OF TOTAL DISCONNECTORS" | Out-File $FileSyncStats

for( [int]$iCounter=0; $iCounter -lt $GetMACount; $iCounter++ ){

$MA = $GetManagementAgents[$iCounter]
$GetConnectors = $MA.NumConnectors().ReturnValue
$GetDisconnectors = $MA.NumDisconnectors().ReturnValue
$GetTotalObjects = $MA.NumCSObjects().ReturnValue
$GetExplicitConnectors = $MA.NumExplicitConnectors().ReturnValue
$GetExplicitDisconnectors = $MA.NumExplicitDisconnectors().ReturnValue
$GetExportAdd = $MA.NumExportAdd().ReturnValue
$GetExportDelete = $MA.NumExportDelete().ReturnValue
$GetExportUpdate = $MA.NumExportUpdate().ReturnValue
$GetFilteredDisconnectors = $MA.NumFilteredDisconnectors().ReturnValue
$GetImportAdd = $MA.NumImportAdd().ReturnValue
$GetImportDelete = $MA.NumImportDelete().ReturnValue
$GetImportNoChange = $MA.NumImportNoChange().ReturnValue
$GetImportUpdate = $MA.NumImportUpdate().ReturnValue
$GetPlaceholders = $MA.NumPlaceholders().ReturnValue
$GetTotalConnectors = $MA.NumTotalConnectors().ReturnValue
$GetTotalDisconnectors = $MA.NumTotalDisconnectors().ReturnValue
$MAName = $MA.Name
$MAGuid = $MA.Guid
$MAType = $MA.Type

$MAStats=$MAName+"`t"+$MAGuid+"`t"+$MAType+"`t"+$GetConnectors+"`t"+$GetTotalObjects+"`t"+$GetDisconnectors+"`t"+$GetExplicitConnectors+"`t"+$GetExplicitDisconnectors+"`t"+$GetExportAdd+"`t"+$GetExportDelete+"`t"+$GetExportUpdate+"`t"+$GetFilteredDisconnectors+"`t"+$GetImportAdd+"`t"+$GetImportDelete+"`t"+$GetImportNoChange+"`t"+$GetImportUpdate+"`t"+$GetPlaceholders+"`t"+$GetTotalConnectors+"`t"+$GetTotalDisconnectors

$MAStats | Out-File $FileSyncStats -Append
}