How to Read the Tally Intervals for a Configuration Manager Site
In Configuration Manager, you can read the available tally intervals for a site by inspecting the site control file SMS_COMPONENT_STATUS_SUMMARIZER
object Summary_Intervals
embedded property list.
You use tally intervals for querying component (SMS_ComponentSummarizer
) and site detail (SMS_SiteDetailSummarizer
) summarizer classes. For more information, see About Configuration Manager Status Summarizers.
To read the tally intervals for a site
Set up a connection to the SMS Provider. For more information, see SMS Provider fundamentals.
Perform a query for the site's SMS_COMPONENT_STATUS_SUMMARIZER property lists
In the results from step two, search for the Summary_Intervals embedded property list.
Display the contents of the embedded property list.
Example
The following example method returns a SMS_TaskSequence object after importing it from the supplied XML.
For information about calling the sample code, see Calling Configuration Manager Code Snippets.
Sub ShowSiteTallyIntervals(connection, siteCode)
Dim SCIComponent 'SMS_SCI_Component class
Dim SCIComponentSet 'Enumeration of SMS_SCI_Component
Dim query
Dim i
Dim vProperty 'Embedded property
query = "SELECT PropLists FROM SMS_SCI_Component " & _
"WHERE ComponentName = 'SMS_COMPONENT_STATUS_SUMMARIZER' " & _
"AND SiteCode = '" + siteCode + "'"
' You do not need to get a copy of the site control file just to read it.
Set SCIComponentSet = connection.ExecQuery(query)
' The query returns only one instance.
For Each SCIComponent In SCIComponentSet
For Each vProperty In SCIComponent.PropLists
If vProperty.PropertyListName = "Summary_Intervals" Then
For i = 0 To UBound(vProperty.Values)
WScript.Echo vProperty.Values(i)
Next
End If
Next
Next
End Sub
public void ShowSiteTallyIntervals(WqlConnectionManager connection, string siteCode)
{
try
{
// Query for the site's site control file SMS_COMPONENT_STATUS_SUMMARIZER property lists.
IResultObject query =
connection.QueryProcessor.ExecuteQuery("SELECT PropLists FROM SMS_SCI_Component " +
"WHERE ComponentName = 'SMS_COMPONENT_STATUS_SUMMARIZER' " +
"AND SiteCode = '" + siteCode + "'");
foreach (IResultObject r in query)
{
// Get the summary intervals and display them.
if (r.EmbeddedPropertyLists.ContainsKey("Summary_Intervals"))
{
Console.WriteLine(r.EmbeddedPropertyLists["Summary_Intervals"]["PropertyListName"].StringValue);
foreach (string value in r.EmbeddedPropertyLists["Summary_Intervals"]["Values"].StringArrayValue)
{
Console.WriteLine(value);
}
}
else
{
Console.WriteLine("Not found");
return;
}
}
}
catch (SmsException e)
{
Console.WriteLine("Failed to tally intervals: " + e.Message);
throw;
}
}
The example method has the following parameters:
Parameter | Type | Description |
---|---|---|
connection |
- Managed: WqlConnectionManager - VBScript: SWbemServices |
A valid connection to the SMS Provider. For more information, see SMS Provider fundamentals. |
siteCode |
- Managed: String - VBScript: String |
A valid Configuration Manager site code. |
Compiling the Code
This C# example requires:
Namespaces
System
System.Collections.Generic
System.Text
Microsoft.ConfigurationManagement.ManagementProvider
Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine
Assembly
adminui.wqlqueryengine
microsoft.configurationmanagement.managementprovider
Robust Programming
For more information about error handling, see About Configuration Manager Errors.
.NET Framework Security
For more information about securing Configuration Manager applications, see Configuration Manager role-based administration.
See Also
About status messages
About Configuration Manager Tally Intervals
About Configuration Manager Status Summarizers
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for