如何将 PXE 服务点响应设置为所有网络接口
在 Configuration Manager 中,通过设置嵌入式 属性,将操作系统部署 PXE 服务点响应设置为BindPolicy
网络接口。
BindPolicy
具有以下可能值。
值 | 说明 |
---|---|
0 | 响应所有网络接口上的 PXE 请求。 |
1 | 响应特定网络接口上的请求。 |
如果 BindPolicy
设置为响应特定网络接口 (1) ,则必须使用 BindExcept
列表为所需网络接口添加媒体访问控制 (MAC) 地址。 如果未 BindExcept
填充 ,PXE 将不会响应任何请求。 有关详细信息,请参阅 如何为特定网络接口设置 PXE 服务点响应。
将 PXE 响应设置为网络接口
设置与 SMS 提供程序的连接。 有关详细信息,请参阅 SMS 提供程序基础知识。
与启用了 PXE 的分发点实例建立连接。
获取嵌入的属性。
BindPolicy
更新嵌入属性。提交对站点控制文件的更改。
示例
以下示例方法将 PXE 服务点响应设置为网络接口。 如果 respondToSpecificInterface
设置为 1
,则必须设置 BindExcept
列表以指定可以响应的网络接口。 有关详细信息,请参阅 如何为特定网络接口设置 PXE 服务点响应。
有关调用示例代码的信息,请参阅调用Configuration Manager代码片段。
public void SetNetworkInterface(WqlConnectionManager connection, string siteCode, string serverName, string respondToSpecificInterface){ 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: BindPolicy if (kvp.Value.PropertyList["PropertyName"] == "BindPolicy") { // 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["BindPolicy"]["Value"].StringValue = respondToSpecificInterface; Console.WriteLine("Setting the {0} value to {1}.", kvp.Value.PropertyList["PropertyName"], respondToSpecificInterface); } } // 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); }}
示例方法具有以下参数:
参数 | 类型 | 说明 |
---|---|---|
connection |
管理: WqlConnectionManager |
与 SMS 提供程序的有效连接。 |
siteCode |
管理: String |
Configuration Manager站点代码。 |
serverName |
管理: String |
服务器名称。 例如,"SERVER1.DOMAIN1.COM" 。 |
respondToSpecficInterface |
管理: String |
要设置哪些网络接口将响应 PXE 请求的值。 - 0 - 响应所有网络接口上的 PXE 请求。 - 1 - 响应特定网络接口上的请求。 |
编译代码
C# 示例具有以下编译要求:
命名空间
System
System.Collections.Generic
System.Text
Microsoft。ConfigurationManagement.ManagementProvider
Microsoft。ConfigurationManagement.ManagementProvider.WqlQueryEngine
Assembly
microsoft.configurationmanagement.managementprovider
adminui.wqlqueryengine
可靠编程
有关错误处理的详细信息,请参阅关于Configuration Manager错误。
.NET Framework 安全性
有关保护Configuration Manager应用程序的详细信息,请参阅Configuration Manager基于角色的管理。
另请参阅
关于 OS 部署站点角色配置如何设置特定网络接口的 PXE 服务点响应
如何使用托管代码读取和写入Configuration Manager站点控制文件
如何使用 WMI 读取和写入Configuration Manager站点控制文件