In System Center 2012 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 About the SMS Provider in Configuration Manager.
-
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.
C# | Copy Code |
---|---|
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 |
|
A valid connection to the SMS Provider. |
serverName |
|
The Configuration Manager server. |
siteCode |
|
The Configuration Manager site code. |
macAddress |
|
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.
Security
For more information about securing Configuration Manager applications, see Securing Configuration Manager Applications.
See Also
Tasks
How to Read and Write to the Configuration Manager Site Control File by Using Managed CodeHow to Read and Write to the Configuration Manager Site Control File by Using WMI
Concepts
About Operating System Deployment Site Role ConfigurationConfiguration Manager Operating System Deployment
Configuration Manager Programming Fundamentals
Operating System Deployment Site Role Configuration