Megjegyzés
Az oldalhoz való hozzáféréshez engedély szükséges. Megpróbálhat bejelentkezni vagy módosítani a címtárat.
Az oldalhoz való hozzáféréshez engedély szükséges. Megpróbálhatja módosítani a címtárat.
Az Active Directory-csoportfelderítési beállításokat a Configuration Manager konfigurálhatja a szükséges helyvezérlő fájlbeállítások módosításával.
Az Active Directory-csoportfelderítés konfigurálása
Állítson be egy kapcsolatot az SMS-szolgáltatóval.
Létesítsen kapcsolatot a helyvezérlő fájl Active Directory-csoportfelderítés szakaszával a
SMS_SCI_Component
osztály használatával.Végighalad az elérhető tulajdonságok tömbjén, és szükség szerint módosításokat hajt végre.
Véglegesítse a webhelyvezérlő fájl módosításait.
Példa
Az alábbi példa az Active Directory-csoportfelderítés beállításait állítja be a osztály használatával a SMS_SCI_Component
helyvezérlő fájlhoz való csatlakozáshoz és a tulajdonságok módosításához.
A mintakód meghívásával kapcsolatos információkért lásd: Configuration Manager Kódrészletek hívása.
Sub ConfigureADGroupDiscoverySettings(swbemServices, _
swbemContext, _
siteCode, _
serverName, _
newStartupSchedule, _
enableDisableDiscovery)
' Load site control file and get the SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT section.
swbemServices.ExecMethod "SMS_SiteControlFile.Filetype=1,Sitecode=""" & siteCode & """", "Refresh", , , swbemContext
Query = "SELECT * FROM SMS_SCI_Component " & _
"WHERE ItemName = 'SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT|" & serverName & "' " & _
"AND SiteCode = '" & siteCode & "'"
' Get the SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT properties.
Set SCIComponentSet = swbemServices.ExecQuery(Query, ,wbemFlagForwardOnly Or wbemFlagReturnImmediately, swbemContext)
' Only one instance is returned from the query.
For Each SCIComponent In SCIComponentSet
' Display the server name.
wscript.echo "Server: " & SCIComponent.Name
' Loop through the array of embedded SMS_EmbeddedProperty instances.
For Each vProperty In SCIComponent.Props
' Setting: Startup Schedule
If vProperty.PropertyName = "Startup Schedule" Then
wscript.echo " "
wscript.echo vProperty.PropertyName
wscript.echo "Current value " & vProperty.Value1
' Modify the value.
vProperty.Value1 = newStartupSchedule
wscript.echo "New value " & newStartupSchedule
End If
' Setting: SETTINGS
If vProperty.PropertyName = "SETTINGS" Then
wscript.echo " "
wscript.echo vProperty.PropertyName
wscript.echo "Current value " & vProperty.Value1
' Modify the value.
vProperty.Value1 = enableDisableDiscovery
wscript.echo "New value " & enableDisableDiscovery
End If
Next
' Update the component in your copy of the site control file. Get the path
' to the updated object, which could be used later to retrieve the instance.
Set SCICompPath = SCIComponent.Put_(wbemChangeFlagUpdateOnly, swbemContext)
Next
' Commit the change to the actual site control file.
Set InParams = swbemServices.Get("SMS_SiteControlFile").Methods_("CommitSCF").InParameters.SpawnInstance_
InParams.SiteCode = siteCode
swbemServices.ExecMethod "SMS_SiteControlFile", "CommitSCF", InParams, , swbemContext
End Sub
public void ConfigureADGroupDiscoverySettings(WqlConnectionManager connection,
string siteCode,
string serverName,
string newStartupSchedule,
string enableDisableDiscovery)
{
try
{
// Connect to SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT section of the site control file.
IResultObject siteDefinition = connection.GetInstance(@"SMS_SCI_Component.FileType=2,ItemType='Component',SiteCode='" + siteCode + "',ItemName='SMS_AD_SECURITY_GROUP_DISCOVERY_AGENT|" + serverName + "'");
// Create temporary copy of the embedded properties.
Dictionary<string, IResultObject> embeddedProperties = siteDefinition.EmbeddedProperties;
// Enumerate through the embedded properties and makes changes as needed.
foreach (KeyValuePair<string, IResultObject> kvp in siteDefinition.EmbeddedProperties)
{
// Setting: Startup Schedule
if (kvp.Value.PropertyList["PropertyName"] == "Startup Schedule")
{
Console.WriteLine();
Console.WriteLine(kvp.Value.PropertyList["PropertyName"]);
Console.WriteLine("Current value: " + kvp.Value.PropertyList["Value1"]);
// Change value using the newStartupSchedule value passed in.
embeddedProperties["Startup Schedule"]["Value1"].StringValue = newStartupSchedule;
Console.WriteLine("New value : " + newStartupSchedule);
}
// Setting: SETTINGS
if (kvp.Value.PropertyList["PropertyName"] == "SETTINGS")
{
Console.WriteLine();
Console.WriteLine(kvp.Value.PropertyList["PropertyName"]);
Console.WriteLine("Current value: " + kvp.Value.PropertyList["Value1"]);
// Change value using the newEnableHeartbeatDDR value passed in.
embeddedProperties["SETTINGS"]["Value1"].StringValue = enableDisableDiscovery;
Console.WriteLine("New value : " + enableDisableDiscovery);
}
}
// Store the settings that have changed.
siteDefinition.EmbeddedProperties = embeddedProperties;
// Save the settings.
siteDefinition.Put();
}
catch (SmsException ex)
{
Console.WriteLine("Failed. Error: " + ex.InnerException.Message);
throw;
}
}
A példametódus a következő paraméterekkel rendelkezik:
Paraméter | Típus | Leírás |
---|---|---|
- connection - swbemServices |
-Kezelt: WqlConnectionManager - VBScript: SWbemServices |
Érvényes kapcsolat az SMS-szolgáltatóval. |
swbemContext |
-Vbscript: SWbemContext |
Érvényes környezeti objektum. További információ: Configuration Manager környezeti minősítő hozzáadása WMI használatával. |
siteCode |
-Kezelt: String -Vbscript: String |
A helykód. |
serverName |
-Kezelt: String -Vbscript: String |
A kiszolgáló neve. |
newStartupSchedule |
-Kezelt: String -Vbscript: String |
Az új ütemezés. |
enableDisableDiscovery |
-Kezelt: String -Vbscript: String |
A felderítési módszer engedélyezésére vagy letiltására vonatkozó érték. Letiltva – INAKTÍV Engedélyezve – AKTÍV |
A kód fordítása
Ehhez a C#-példához a következőre van szükség:
Névterek
Rendszer
System.Collections.Generic
System.Text
Microsoft.ConfigurationManagement.ManagementProvider
Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine
Összeszerelés
adminui.wqlqueryengine
microsoft.configurationmanagement.managementprovider
Robusztus programozás
A hibakezeléssel kapcsolatos további információkért lásd: A Configuration Manager hibák ismertetése.
.NET-keretrendszer Security
A Configuration Manager alkalmazások biztonságossá tételével kapcsolatos további információkért lásd: Configuration Manager szerepköralapú felügyelet.
Lásd még
Tudnivalók a Configuration Manager webhelyvezérlő fájlról
Az Configuration Manager helyvezérlő fájl olvasása és írása felügyelt kód használatával
A Configuration Manager helyvezérlő fájl olvasása és írása WMI használatával
SMS_SCI_Component kiszolgálói WMI-osztály
Az ütemezések ismertetéseÜtemezési token Létrehozás