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.
A Configuration Manager a helyvezérlő fájl konfigurálja a hely konfigurációját. Ez a témakör bemutatja, hogyan konfigurálhatja a szoftverterjesztésben meghirdetett programokat ügyfélügynök-beállításokat a helyvezérlő fájlban. A webhelyvezérlő fájlból való olvasásról és a webhelyvezérlő fájlba való írásról további információt a Tudnivalók a helyvezérlő fájlról című témakörben talál.
Figyelem!
Mielőtt az SMS Provider osztályokkal módosítaná a hely konfigurációját, tapasztaltnak kell lennie a hely konfigurációjának kezelésében. Körültekintően járjon el, vagy kerülje a és SMS_SCI_SiteDefinition
az SMS_SCI_FileDefinition
osztály használatát. Ezek az osztályok kezelik magát a helyvezérlő fájlt. Bizonyos konfigurálható elemek módosításával jelentős károkat okozhat a webhelyeken.
Az ügyfélügynök beállításainak konfigurálása
Állítson be egy kapcsolatot az SMS-szolgáltatóval. További információ: Az SMS-szolgáltató alapjai.
Létesítsen kapcsolatot a helyvezérlő fájl szoftverterjesztési ügyfél összetevő szakaszával a SMS_SCI_ClientComp 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 tulajdonság módosításait a helyvezérlő fájlban.
Példa
Az alábbi példa lekérdezi a helyvezérlő fájl szoftverterjesztési ügyfél összetevő szakaszának adott elemeit, és módosítja az adott ügyfélügynök beállításait.
A mintakód meghívásával kapcsolatos információkért lásd: Configuration Manager Kódrészletek hívása.
Sub ConfigureClientAgentSettings(swbemServices, swbemContext, siteToChange, enableDisableSWDClientAgent, enableDisableRequestUserPolicy, setPolicyRefreshInterval, enableDisableVisibleSignalOnAvailable, enableDisableAudibleSignalonAvailable,enableDisableCountdownSignal,setCountdownMinutes, enableDisableShowIcon)
' Load site control file and get SWD client component section.
swbemServices.ExecMethod "SMS_SiteControlFile.Filetype=1,Sitecode=""" & siteToChange & """", "Refresh", , , swbemContext
Set objSWbemInst = swbemServices.Get("SMS_SCI_ClientComp.Filetype=1,Itemtype='Client Component',Sitecode='" & siteToChange & "',ItemName='Software Distribution'", , swbemContext)
' Display SWD client agent settings before change.
Wscript.Echo " "
Wscript.Echo "Before Change"
Wscript.Echo "-------------"
Wscript.Echo " "
Wscript.Echo objSWbemInst.ClientComponentName
Wscript.Echo "Current value: " & objSWbemInst.Flags & " (0 = Disabled, 1 = Enabled)"
Wscript.Echo " "
objSWbemInst.Flags = enableDisableSWDClientAgent
' Enumerate though the property array, but display only the properties that we're specifically interested in.
' Note: A list of all properties could be generated by just using the following code:
' PropertyArray = objSwbemInst.props
' For i = 0 to ubound(PropertyArray)
' Wscript.Echo PropertyArray(i).PropertyName
' Wscript.Echo "Current value: " & PropertyArray(i).Value
' Next
PropertyArray = objSwbemInst.props
For i = 0 to ubound(PropertyArray)
' Client settings: Allow user targeted advertisement requests.
If PropertyArray(i).PropertyName = "Request User Policy" Then
Wscript.Echo PropertyArray(i).PropertyName
Wscript.Echo "Current value: " & PropertyArray(i).Value
Wscript.Echo " "
PropertyArray(i).Value = enableDisableRequestUserPolicy
End If
' Client settings: Policy polling interval (minutes).
If PropertyArray(i).PropertyName = "Policy Refresh Interval" Then
Wscript.Echo PropertyArray(i).PropertyName
Wscript.Echo "Current value: " & PropertyArray(i).Value
Wscript.Echo " "
PropertyArray(i).Value = setPolicyRefreshInterval
End If
' When new advertised programs are available: Display a notification message.
If PropertyArray(i).PropertyName = "Visible Signal on Available" Then
Wscript.Echo PropertyArray(i).PropertyName
Wscript.Echo "Current value: " & PropertyArray(i).Value
Wscript.Echo " "
PropertyArray(i).Value = enableDisableVisibleSignalOnAvailable
End If
' When new advertised programs are available: Play a sound.
If PropertyArray(i).PropertyName = "Audible Signal on Available" Then
Wscript.Echo PropertyArray(i).PropertyName
Wscript.Echo "Current value: " & PropertyArray(i).Value
Wscript.Echo " "
PropertyArray(i).Value = enableDisableAudibleSignalonAvailable
End If
' When a scheduled program is about to run: Provide a countdown.
If PropertyArray(i).PropertyName = "Countdown Signal" Then
Wscript.Echo PropertyArray(i).PropertyName
Wscript.Echo "Current value: " & PropertyArray(i).Value
Wscript.Echo " "
PropertyArray(i).Value = enableDisableCountdownSignal
End If
' Countdown length (minutes).
If PropertyArray(i).PropertyName = "Countdown Minutes" Then
Wscript.Echo PropertyArray(i).PropertyName
Wscript.Echo "Current value: " & PropertyArray(i).Value
Wscript.Echo " "
PropertyArray(i).Value = setCountdownMinutes
End If
' Show advertised program notification icons in the notification area.
If PropertyArray(i).PropertyName = "Show Icon" Then
Wscript.Echo PropertyArray(i).PropertyName
Wscript.Echo "Current value: " & PropertyArray(i).Value
Wscript.Echo " "
PropertyArray(i).Value = enableDisableShowIcon
End If
Next
' Save new client agent settings.
objSWbemInst.Put_ , swbemContext
swbemServices.ExecMethod "SMS_SiteControlFile.Filetype=1,Sitecode=""" & siteToChange & """", "Commit", , , swbemContext
' Refresh in-memory copy of the site control file and get the SWD client component section.
swbemServices.ExecMethod "SMS_SiteControlFile.Filetype=1,Sitecode=""" & siteToChange & """", "Refresh", , , swbemContext
Set objSWbemInst = swbemServices.Get("SMS_SCI_ClientComp.Filetype=1,Itemtype='Client Component',Sitecode='" & siteToChange & "',ItemName='Software Distribution'", , swbemContext)
' Display SWD client agent settings after change.
Wscript.Echo " "
Wscript.Echo "After Change"
Wscript.Echo "------------"
Wscript.Echo " "
Wscript.Echo objSWbemInst.ClientComponentName
Wscript.Echo "Current value: " & objSWbemInst.Flags & " (0 = Disabled, 1 = Enabled)"
Wscript.Echo " "
PropertyArray = objSwbemInst.props
For i = 0 to ubound(PropertyArray)
' Client settings: Allow user targeted advertisement requests.
If PropertyArray(i).PropertyName = "Request User Policy" Then
Wscript.Echo PropertyArray(i).PropertyName
Wscript.Echo "Current value: " & PropertyArray(i).Value
Wscript.Echo " "
End If
' Client settings: Policy polling interval (minutes).
If PropertyArray(i).PropertyName = "Policy Refresh Interval" Then
Wscript.Echo PropertyArray(i).PropertyName
Wscript.Echo "Current value: " & PropertyArray(i).Value
Wscript.Echo " "
End If
' When new advertised programs are available: Display a notification message.
If PropertyArray(i).PropertyName = "Visible Signal on Available" Then
Wscript.Echo PropertyArray(i).PropertyName
Wscript.Echo "Current value: " & PropertyArray(i).Value
Wscript.Echo " "
End If
' When new advertised programs are available: Play a sound.
If PropertyArray(i).PropertyName = "Audible Signal on Available" Then
Wscript.Echo PropertyArray(i).PropertyName
Wscript.Echo "Current value: " & PropertyArray(i).Value
Wscript.Echo " "
End If
' When a scheduled program is about to run: Provide a countdown.
If PropertyArray(i).PropertyName = "Countdown Signal" Then
Wscript.Echo PropertyArray(i).PropertyName
Wscript.Echo "Current value: " & PropertyArray(i).Value
Wscript.Echo " "
End If
' Countdown length (minutes).
If PropertyArray(i).PropertyName = "Countdown Minutes" Then
Wscript.Echo PropertyArray(i).PropertyName
Wscript.Echo "Current value: " & PropertyArray(i).Value
Wscript.Echo " "
End If
' Show advertised program notification icons in the notification area.
If PropertyArray(i).PropertyName = "Show Icon" Then
Wscript.Echo PropertyArray(i).PropertyName
Wscript.Echo "Current value: " & PropertyArray(i).Value
Wscript.Echo " "
End If
Next
End Sub
public void ConfigureSWDClientAgentSettings(WqlConnectionManager connection, string siteCode, string enableDisableSWDClientAgent, string enableDisableRequestUserPolicy, string setPolicyRefreshInterval, string enableDisableVisibleSignalOnAvailable, string enableDisableAudibleSignalonAvailable, string enableDisableCountdownSignal, string setCountdownMinutes, string enableDisableShowIcon)
{
try
{
IResultObject siteDefinition = connection.GetInstance(@"SMS_SCI_ClientComp.FileType=1,ItemType='Client Component',SiteCode='" + siteCode + "',ItemName='Software Distribution'");
Console.WriteLine();
Console.WriteLine("Before Change");
Console.WriteLine("-------------");
// Enable software distribution to clients.
// Set SWD client agent by setting flags value to 0 or 1 using the EnableDisableSWDClientAgent variable.
Console.WriteLine("Software Distribution Client Agent");
Console.WriteLine("Current value: " + siteDefinition["Flags"].StringValue + " (0 = Disabled, 1 = Enabled)");
siteDefinition["Flags"].StringValue = enableDisableSWDClientAgent;
foreach (KeyValuePair<string, IResultObject> kvp in siteDefinition.EmbeddedProperties)
{
Dictionary<string, IResultObject> embeddedProperties = siteDefinition.EmbeddedProperties; // temp copy
// Client settings: Allow user targeted advertisement requests.
if (kvp.Value.PropertyList["PropertyName"] == "Request User Policy")
{
Console.WriteLine(kvp.Value.PropertyList["PropertyName"]);
Console.WriteLine("Current value: " + embeddedProperties["Request User Policy"]["Value"].StringValue);
embeddedProperties["Request User Policy"]["Value"].StringValue = enableDisableRequestUserPolicy;
}
// Client settings: Policy polling interval (minutes).
if (kvp.Value.PropertyList["PropertyName"] == "Policy Refresh Interval")
{
Console.WriteLine(kvp.Value.PropertyList["PropertyName"]);
Console.WriteLine("Current value: " + embeddedProperties["Policy Refresh Interval"]["Value"].StringValue);
embeddedProperties["Policy Refresh Interval"]["Value"].StringValue = setPolicyRefreshInterval;
}
// When new advertised programs are available: Display a notification message.
if (kvp.Value.PropertyList["PropertyName"] == "Visible Signal on Available")
{
Console.WriteLine(kvp.Value.PropertyList["PropertyName"]);
Console.WriteLine("Current value: " + embeddedProperties["Visible Signal on Available"]["Value"].StringValue);
embeddedProperties["Visible Signal on Available"]["Value"].StringValue = enableDisableVisibleSignalOnAvailable;
}
// When new advertised programs are available: Play a sound.
if (kvp.Value.PropertyList["PropertyName"] == "Audible Signal on Available")
{
Console.WriteLine(kvp.Value.PropertyList["PropertyName"]);
Console.WriteLine("Current value: " + embeddedProperties["Audible Signal on Available"]["Value"].StringValue);
embeddedProperties["Audible Signal on Available"]["Value"].StringValue = enableDisableAudibleSignalonAvailable;
}
// When a scheduled program is about to run: Provide a countdown.
if (kvp.Value.PropertyList["PropertyName"] == "Countdown Signal")
{
Console.WriteLine(kvp.Value.PropertyList["PropertyName"]);
Console.WriteLine("Current value: " + embeddedProperties["Countdown Signal"]["Value"].StringValue);
embeddedProperties["Countdown Signal"]["Value"].StringValue = enableDisableCountdownSignal;
}
// Countdown length (minutes).
if (kvp.Value.PropertyList["PropertyName"] == "Countdown Minutes")
{
Console.WriteLine(kvp.Value.PropertyList["PropertyName"]);
Console.WriteLine("Current value: " + embeddedProperties["Countdown Minutes"]["Value"].StringValue);
embeddedProperties["Countdown Minutes"]["Value"].StringValue = setCountdownMinutes;
}
// Show advertised program notification icons in the notification area.
if (kvp.Value.PropertyList["PropertyName"] == "Show Icon")
{
Console.WriteLine(kvp.Value.PropertyList["PropertyName"]);
Console.WriteLine("Current value: " + embeddedProperties["Show Icon"]["Value"].StringValue);
embeddedProperties["Show Icon"]["Value"].StringValue = enableDisableShowIcon;
}
// Store the settings that have changed.
siteDefinition.EmbeddedProperties = embeddedProperties;
}
// Save the settings.
siteDefinition.Put();
// Verify change by reconnecting and getting the value again.
IResultObject siteDefinition2 = connection.GetInstance(@"SMS_SCI_ClientComp.FileType=1,ItemType='Client Component',SiteCode='" + siteCode + "',ItemName='Software Distribution'");
Console.WriteLine();
Console.WriteLine("After Change");
Console.WriteLine("-------------");
// Enable software distribution to clients.
Console.WriteLine("Software Distribution Client Agent");
Console.WriteLine("Current value: " + siteDefinition2["Flags"].StringValue + " (0 = Disabled, 1 = Enabled)");
foreach (KeyValuePair<string, IResultObject> kvp in siteDefinition2.EmbeddedProperties)
{
Dictionary<string, IResultObject> embeddedProperties = siteDefinition2.EmbeddedProperties; // temp copy
// Client settings: Allow user targeted advertisement requests.
if (kvp.Value.PropertyList["PropertyName"] == "Request User Policy")
{
Console.WriteLine(kvp.Value.PropertyList["PropertyName"]);
Console.WriteLine("Current value: " + embeddedProperties["Request User Policy"]["Value"].StringValue);
}
// Client settings: Policy polling interval (minutes).
if (kvp.Value.PropertyList["PropertyName"] == "Policy Refresh Interval")
{
Console.WriteLine(kvp.Value.PropertyList["PropertyName"]);
Console.WriteLine("Current value: " + embeddedProperties["Policy Refresh Interval"]["Value"].StringValue);
}
// When new advertised programs are available: Display a notification message.
if (kvp.Value.PropertyList["PropertyName"] == "Visible Signal on Available")
{
Console.WriteLine(kvp.Value.PropertyList["PropertyName"]);
Console.WriteLine("Current value: " + embeddedProperties["Visible Signal on Available"]["Value"].StringValue);
}
// When new advertised programs are available: Play a sound.
if (kvp.Value.PropertyList["PropertyName"] == "Audible Signal on Available")
{
Console.WriteLine(kvp.Value.PropertyList["PropertyName"]);
Console.WriteLine("Current value: " + embeddedProperties["Audible Signal on Available"]["Value"].StringValue);
}
// When a scheduled program is about to run: Provide a countdown.
if (kvp.Value.PropertyList["PropertyName"] == "Countdown Signal")
{
Console.WriteLine(kvp.Value.PropertyList["PropertyName"]);
Console.WriteLine("Current value: " + embeddedProperties["Countdown Signal"]["Value"].StringValue);
}
// Countdown length (minutes).
if (kvp.Value.PropertyList["PropertyName"] == "Countdown Minutes")
{
Console.WriteLine(kvp.Value.PropertyList["PropertyName"]);
Console.WriteLine("Current value: " + embeddedProperties["Countdown Minutes"]["Value"].StringValue);
}
// Show advertised program notification icons in the notification area.
if (kvp.Value.PropertyList["PropertyName"] == "Show Icon")
{
Console.WriteLine(kvp.Value.PropertyList["PropertyName"]);
Console.WriteLine("Current value: " + embeddedProperties["Show Icon"]["Value"].StringValue);
}
}
Console.WriteLine(" ");
}
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 siteToChange |
-Kezelt: String -Vbscript: String |
A helykód. |
enableDisableSWDClientAgent |
-Kezelt: String -Vbscript: String |
Jelölő az ügyfélügynök engedélyezéséhez vagy letiltásához. |
setPolicyRefreshInterval |
-Kezelt: String -Vbscript: String |
A szabályzat lekérdezési időköze percekben megadva. |
enableDisableRequestUserPolicy |
-Kezelt: String -Vbscript: String |
Megjelölheti a célzott hirdetéskérések engedélyezéséhez vagy letiltásához. |
enableDisableVisibleSignalOnAvailable |
-Kezelt: String -Vbscript: String |
Értesítés megjelenítésének engedélyezéséhez vagy letiltásához jelölő, ha új meghirdetett programok érhetők el. |
enableDisableAudibleSignalonAvailable |
-Kezelt: String -Vbscript: String |
Jelölő a hangos értesítések engedélyezéséhez vagy letiltásához, ha új meghirdetett programok érhetők el. |
enableDisableCountdownSignal |
-Kezelt: String -Vbscript: String |
Jelölő a visszaszámlálás engedélyezéséhez vagy letiltásához egy ütemezett program futtatásakor. |
setCountdownMinutes |
-Kezelt: String -Vbscript: String |
Visszaszámlálás hossza, percekben megadva. |
enableDisableShowIcon |
-Kezelt: String -Vbscript: String |
Jelölő a meghirdetett programértesítési ikonok megjelenítésének engedélyezéséhez vagy letiltásához az értesítési területen. |
A kód fordítása
A C#-példához a következőre van szükség:
Névterek
Rendszer
System.Collections.Generic
System.ComponentModel
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
Szoftverterjesztés áttekintése– Tudnivalók a szoftverterjesztés beállításáról és konfigurálásárólA Configuration Manager helyvezérlő fájl
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