Initiieren einer SynchronisierungHow to Initiate a Synchronization
Der Asset Intelligence Katalog kann außerhalb des normalen Synchronisierungs Zeitplans manuell aktualisiert werden.The Asset Intelligence catalog can be refreshed manually, outside the normal synchronization schedule. Eine manuelle Aktualisierung erfolgt mithilfe der requestcatalogupdate -Methode für die WMI-Klasse SMS_AIProxy Server.A manual refresh is accomplished by using the RequestCatalogUpdate method on the SMS_AIProxy Server WMI Class.
Wichtig
Diese Methode kann nur einmal innerhalb eines Zeitraums von 12 Stunden aufgerufen werden. nachfolgende Methodenaufrufe können nicht ausgeführt werden.This method can only be called once within a 12 hours period, subsequent method calls will not work.
Asset Intelligence Katalog aktualisierenRefresh the Asset Intelligence catalog
Richten Sie eine Verbindung mit dem SMS-Anbieter ein.Set up a connection to the SMS Provider. Weitere Informationen finden Sie unter Grundlagen des SMS-Anbieters.For more information, see SMS Provider fundamentals.
Fragen Sie den SMS-Anbieter nach der SMS_AIProxy -Instanz ab, auf der Sie den Katalog aktualisieren möchten.Query the SMS Provider for the SMS_AIProxy instance that you want refresh the catalog on.
Aufrufen der SMS_AIProxy-Klasse requestcatalogupdate -Methode, um eine Aktion für die Auflistung auszuführen.Call the SMS_AIProxy class RequestCatalogUpdate method to run an action on the collection.
BeispielExample
Die folgende Beispiel Methode führt die Aktualisierung auf dem bereitgestellten Server aus.The following example method runs the refresh on the provided server.
Informationen zum Aufrufen des Beispielcodes finden Sie unter Aufrufen von Configuration Manager-Codeausschnitten.For information about calling the sample code, see Calling Configuration Manager Code Snippets.
Function InitiateSync(connection, serverName)
On Error Resume Next
Dim classObj: Set classObj = connection.Get("SMS_AIProxy")
Dim inParams: Set inParams = classObj.Methods_("RequestCatalogUpdate").InParameters.SpawnInstance_()
Dim outParams
inParams.Properties_.Item("ProxyName") = serverName
Set outParams = connection.ExecMethod("SMS_AIProxy", "RequestCatalogUpdate", inParams)
If Err.Number <> 0 Then
InitiateSync = False
Else
InitiateSync = True
End If
On Error Goto 0
End Function
public void InitiateSync(WqlConnectionManager connection, string serverName)
{
try
{
Dictionary<string, object> inParams = new Dictionary<string, object>();
IResultObject classObj = connection.GetClassObject("SMS_AIProxy");
inParams.Add("ProxyName", serverName);
Console.WriteLine("Requesting catalog update on server " + serverName);
classObj.ExecuteMethod("RequestCatalogUpdate", inParams);
}
catch (SmsException ex)
{
Console.WriteLine(String.Format("Failed to request catalog update on server {0}. Error: {1}", serverName, ex.Message));
throw;
}
}
Die Beispielmethode verfügt über die folgenden Parameter:The example method has the following parameters:
ParameterParameter | typeType | BESCHREIBUNGDescription |
---|---|---|
connectionconnection | Ge WqlConnectionManager Managed: WqlConnectionManager VBScript: austauschen von DienstenVBScript: SWbemServices |
Eine gültige Verbindung mit dem Anbieter.A valid connection to the provider. |
serverNameserverName | Ge String Managed: String VBScript String VBScript: String |
Der Name des Servers, auf dem die Aktualisierung ausgeführt werden soll.Name of the server to run the refresh on. Dieser Name wird der- ProxyName Eigenschaft einer- SMS_AIProxy Instanz zugeordnet.This name maps to the ProxyName property of an SMS_AIProxy instance. |
Kompilieren des CodesCompiling the Code
Für das C#-Beispiel ist Folgendes erforderlich:The C# example requires:
NamespacesNamespaces
SystemSystem
System.Collections.GenericSystem.Collections.Generic
System.TextSystem.Text
Microsoft.ConfigurationManagement.ManagementProviderMicrosoft.ConfigurationManagement.ManagementProvider
Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngineMicrosoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine
AssemblyAssembly
microsoft.configurationmanagement.managementprovidermicrosoft.configurationmanagement.managementprovider
adminui.wqlqueryengineadminui.wqlqueryengine
Stabile ProgrammierungRobust Programming
Weitere Informationen zur Fehlerbehandlung finden Sie unter Informationen zu Configuration Manager-Fehlern.For more information about error handling, see About Configuration Manager Errors.
.NET Framework-Sicherheit.NET Framework Security
Weitere Informationen zum Sichern von Configuration Manager Anwendungen finden Sie unter Configuration Manager rollenbasierte Verwaltung.For more information about securing Configuration Manager applications, see Configuration Manager role-based administration.