How to Set the PXE Service Point Response for a Specific Network Interface
In Configuration Manager, you set the operating system deployment to respond to a specific set of network addresses by adding the required media access control (MAC) addresses to the BindExcept
embedded property list. You must also set the BindPolicy
embedded property to 1. This specifies that PXE requests are accepted on specified network address only. For more information about setting BindPolicy
, see How to Set the PXE Service Point Response to All Network Interfaces.
To set the response for a specific network interface
Set up a connection to the SMS Provider. For more information, see SMS Provider fundamentals.
Make a connection to the PXE service point resources section of the site control file.
Get the
BindExcept
embedded property list.Add the MAC addresses to the
BindExcept
embedded property list.Commit the changes to the site control file.
Example
The following example method adds a supplied MAC address to the list of MAC address that are responded to.
For information about calling the sample code, see Calling Configuration Manager Code Snippets.
public void SetNetworkInterface(WqlConnectionManager connection, string siteCode, string serverName, string macAddress){ 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> embeddedPropertyLists = siteRole.EmbeddedPropertyLists; // Get current mac addresses. string[] macAddresses = embeddedPropertyLists["BindExcept"]["Values"].StringArrayValue; //Convert to list. List<string> addressList = new List<string>(); foreach (string address in macAddresses) { addressList.Add(address); } // Add the new mac address to the list. addressList.Add(macAddress); // Add the new mac address to the list. embeddedPropertyLists["BindExcept"]["Values"].StringArrayValue = addressList.ToArray(); siteRole.EmbeddedPropertyLists = embeddedPropertyLists; // Save the settings. siteRole.Put(); } catch (SmsException ex) { Console.WriteLine(); Console.WriteLine("Failed. Error: " + ex.InnerException.Message); }}
The example method has the following parameters:
Parameter | Type | Description |
---|---|---|
connection |
- Managed: WqlConnectionManager |
A valid connection to the SMS Provider. |
serverName |
- Managed: String |
The Configuration Manager server. |
siteCode |
- Managed: String |
The Configuration Manager site code. |
macAddress |
- Managed: String |
The MAC address to be added in the following format: 00:11:22:33:44:55 |
Compiling the Code
The C# example has the following compilation requirements:
Namespaces
System
System.Collections.Generic
System.Text
Microsoft.ConfigurationManagement.ManagementProvider
Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine
Assembly
microsoft.configurationmanagement.managementprovider
adminui.wqlqueryengine
Robust Programming
For more information about error handling, see About Configuration Manager Errors.
.NET Framework Security
For more information about securing Configuration Manager applications, see Configuration Manager role-based administration.
See Also
About OS deployment site role configuration
How to Read and Write to the Configuration Manager Site Control File by Using Managed Code
How to Read and Write to the Configuration Manager Site Control File by Using WMI