如何設定 PXE 服務點回應 PXE 要求
在Configuration Manager中,您可以設定IsActive內嵌屬性,以設定傳入 PXE 要求的發佈點回應。
IsActive 具有下列可能的值。
值 | 描述 |
---|---|
0 | 發佈點不會回應 PXE 要求。 |
1 | 發佈服務點會回應要求。 |
若要設定 PXE 要求的發佈點回應
設定與 SMS 提供者的連線。 如需詳細資訊,請 參閱 SMS 提供者基本概念。
連線到已啟用 PXE 的發佈點實例。
取得內嵌屬性。
更新 IsActive 內嵌屬性。
將變更認可至月臺控制檔案。
範例
下列範例方法會根據提供的 String
值 allowResponse
() 設定 PXE 要求的回應。
如需呼叫範例程式碼的相關資訊,請參閱呼叫Configuration Manager程式碼片段。
public void SetAllowResponse(WqlConnectionManager connection, string siteCode, string serverName, string allowResponse){ try { //Connect to distribution point instance. IResultObject siteRole = connection.GetInstance("SMS_SCI_SysResUse.FileType=2,ItemName=\"[\\\"Display=\\\\\\\\" + serverName + "\\\\\\\"]MSWNET:[\\\"SMS_SITE=" + siteCode + "\\\"]\\\\\\\\" + serverName + "\\\\,SMS Distribution Point\",ItemType=\"System Resource Usage\",SiteCode=" + "\"" + siteCode + "\""); // Create temporary copy of the embedded properties. Dictionary<string, IResultObject> embeddedProperties = siteRole.EmbeddedProperties; // Enumerate through the embedded properties and makes changes as needed. foreach (KeyValuePair<string, IResultObject> kvp in siteRole.EmbeddedProperties) { // Setting: IsActive if (kvp.Value.PropertyList["PropertyName"] == "IsActive") { // Get current property value. Console.WriteLine(); Console.WriteLine("Property: {0}", kvp.Value.PropertyList["PropertyName"]); Console.WriteLine("Current value: {0}", kvp.Value.PropertyList["Value"]); // Change value. embeddedProperties["IsActive"]["Value"].StringValue = allowResponse; Console.WriteLine("Setting the {0} value to {1}.", kvp.Value.PropertyList["PropertyName"], allowResponse); } } // Store the settings that have changed. siteRole.EmbeddedProperties = embeddedProperties; // Save the settings. siteRole.Put(); } catch (SmsException ex) { Console.WriteLine(); Console.WriteLine("Failed. Error: " + ex.InnerException.Message); }}
範例方法具有下列參數:
參數 | Type | 描述 |
---|---|---|
connection |
管理: WqlConnectionManager |
SMS 提供者的有效連線。 |
siteCode |
管理: String |
Configuration Manager月臺碼。 |
serverName |
管理: String |
伺服器名稱。 例如,"SERVER1.DOMAIN1.COM" 。 |
allowResponse |
管理: String |
要設定發佈點是否會回應 PXE 要求的值。 - 0 - 發佈點不會回應 PXE 要求。 - 1 - PXE 服務點會回應來自未知電腦的要求。 |
正在編譯程式碼
C# 範例具有下列編譯需求:
命名空間
系統
System.Collections.Generic
System.Text
Microsoft。ConfigurationManagement.ManagementProvider
Microsoft。ConfigurationManagement.ManagementProvider.WqlQueryEngine
組件
microsoft.configurationmanagement.managementprovider
adminui.wqlqueryengine
健全的程式設計
如需錯誤處理的詳細資訊,請參閱關於Configuration Manager錯誤。
.NET Framework 安全性
如需保護Configuration Manager應用程式的詳細資訊,請參閱Configuration Manager角色型系統管理。
另請參閱
關於 OS 部署月臺角色設定如何使用 Managed 程式碼讀取和寫入Configuration Manager月臺控制檔案
如何使用 WMI 讀取和寫入Configuration Manager月臺控制檔案