Poznámka
Přístup k této stránce vyžaduje autorizaci. Můžete se zkusit přihlásit nebo změnit adresáře.
Přístup k této stránce vyžaduje autorizaci. Můžete zkusit změnit adresáře.
V Configuration Manager použijete vlastní nastavení klienta tak, že vytvoříte instanci třídy Konfigurace klienta a pak nasadíte vlastní nastavení klienta vytvořením instance SMS_ClientSettingsAssignment
třídy a přidružením instance třídy Konfigurace klienta a cílové kolekce.
Použití vlastního nastavení klienta
Nastavte připojení k poskytovateli serveru SMS.
Vytvořte instanci třídy Konfigurace klienta (například
SMS_StateSystemConfig
použitou níže).Vyplňte konkrétní vlastní nastavení agenta klienta.
Vytvořte instanci
SMS_ClientSettingsAssignment
třídy.Naplňte hodnoty přiřazení nastavení klienta.
ClientSettingsID
k identifikaci instance vlastního nastavení klienta aCollectionID
k identifikaci cílové kolekce pro nasazení vlastního nastavení klienta.
Příklad
Následující příklad aplikuje vlastní nastavení klienta tak, že vytvoří instanci třídy Konfigurace klienta a pak nasadí vlastní nastavení klienta vytvořením instance SMS_ClientSettingsAssignment
třídy a přidružením instance třídy Konfigurace klienta a cílové kolekce.
Informace o volání ukázkového kódu najdete v tématu Volání Configuration Manager fragmentů kódu.
public void ApplyCustomClientSettings(WqlConnectionManager connection,string targetCollectionID){
try
{
// Create a new instance of specific client agent settings (in this case State Messaging)
IResultObject newCustomClientAgentSettings = connection.CreateEmbeddedObjectInstance("SMS_StateSystemConfig");
// Populate specific custom client agent settings
newCustomClientAgentSettings["BulkSendInterval"].IntegerValue = 120;
newCustomClientAgentSettings["BulkSendIntervalHigh"].IntegerValue = 5;
newCustomClientAgentSettings["BulkSendIntervalLow"].IntegerValue = 30;
// Create a new array list to hold the custom client agent settings object(s)
List<IResultObject> tempAgentConfigurationsArray = new List<IResultObject>();
// Add the custom client agent settings embedded object to the local array list
tempAgentConfigurationsArray.Add(newCustomClientAgentSettings);
// Create a new instance of SMS_ClientSettings
IResultObject newClientSettings = connection.CreateInstance("SMS_ClientSettings");
// Populate the client agent settings
newClientSettings["Name"].StringValue = "Custom State Messaging Configuration";
// Add the array of custom client agent settinsg object(s) to the AgentConfigurations property
newClientSettings.SetArrayItems("AgentConfigurations", tempAgentConfigurationsArray);
// Save and retrieve the new instance of SMS_ClientSettings
newClientSettings.Put();
newClientSettings.Get();
// Get the SettingsID value of the new SMS_ClientSettings instance
Int32 SettingsID = newClientSettings["SettingsID"].IntegerValue;
// Create a new instance of SMS_ClientSettingsAssignment
IResultObject newClientSettingsAssignment = connection.CreateInstance("SMS_ClientSettingsAssignment");
// Populate the client settings assignment values
// ClientSettingsID to identify the custom client settings
// CollectionID to identify the target collection for the custom client settings
newClientSettingsAssignment["ClientSettingsID"].IntegerValue = SettingsID;
newClientSettingsAssignment["CollectionID"].StringValue = targetCollectionID;
// Save the new instance of the client settings assignment.
newClientSettingsAssignment.Put();
}
catch (SmsException ex)
{
Console.WriteLine("Failed. Error: " + ex.InnerException.Message);
}
}
Ukázková metoda má následující parametry:
Parametr | Typ | Popis |
---|---|---|
connection |
-Spravované: WqlConnectionManager |
Platné připojení k poskytovateli serveru SMS. |
targetCollectionID |
-Spravované: String |
Cílová kolekce pro nasazení vlastního nastavení klienta. |
Kompilace kódu
Tento příklad jazyka C# vyžaduje:
Obory názvů
Systému
System.collections.generic
System.text
Microsoft. ConfigurationManagement.ManagementProvider
Microsoft. ConfigurationManagement.ManagementProvider.WqlQueryEngine
Sestavení
adminui.wqlqueryengine
microsoft.configurationmanagement.managementprovider
Robustní programování
Další informace o zpracování chyb najdete v tématu Informace o chybách Configuration Manager.
Zabezpečení rozhraní .NET Framework
Další informace o zabezpečení Configuration Manager aplikací najdete v tématu Configuration Manager správa na základě rolí.
Viz taky
Configuration Manager SDK
Serverová třída služby WMI SMS_ClientSettingsAssignment