Udostępnij za pośrednictwem


How to Create a PXE Service Point Role

Applies To: System Center Configuration Manager 2007, System Center Configuration Manager 2007 R2, System Center Configuration Manager 2007 R3, System Center Configuration Manager 2007 SP1, System Center Configuration Manager 2007 SP2

You create the PXE Service Point role, in Microsoft System Center Configuration Manager 2007, by creating an instance of SMS_SCI_SysResUse Server WMI Class and populating various PXE Service Point role embedded properties and property lists. These values are saved to the site control file.

The SMS_SCI_SysResUse Server WMI Class properties you set are:

Name Description

RoleName

The name of the role. For a PXE service point, the value is SMS PXE Service Point.

SiteCode

The site code for the site.

NALPath

The network abstraction layer (NAL) path to the SMS PXE service point. For more information, see PackNALPath Method in Class SMS_NAL_Methods.

NALType

The resource type. For a PXE service point this should be Windows NT Server.

You will also need to set initial values for the following embedded properties and embedded property lists.

Name Description

Server Remote Name

The remote server name for the server hosting PXE service point. Embedded property.

BindPolicy

The PXE service point response to network interfaces. For more information, see How to Set the PXE Service Point Response to Network Interfaces. Embedded property

IsActive

The PXE service point response to PXE requests. For more information, see How to Set the PXE Service Point Response to PXE Requests. Embedded property

ResponseDelay

The PXE service point response delay. For more information, see How to Set the Response Delay for a PXE Service Point. Embedded property.

BindExcept

A list of MAC addresses the PXE service point responds to. For more information, see How to Set the PXE Service Point Response for a Specific Network Interface. Embedded property list.

To create a PXE service point role

  1. Set up a connection to the SMS Provider. For more information see, About the SMS Provider in Configuration Manager.

  2. Create an instance of SMS_SCI_SysResUse.

  3. Populate the properties listed above.

  4. Commit the SMS_SCI_SysResUse object.

Example

The following example method creates a PXE service point from the supplied site code and NAL path. Alternatively to the other example methods that have the server name passed as a parameter, this example gets the server name from the supplied site code. For more information, see SMS_Site Server WMI Class.

For information about calling the sample code, see Calling Configuration Manager Code Snippets.

public void CreatePxe(
WqlConnectionManager connection,
string siteCode,
string nalPath)
{
    try
    {
        string serverName = null;

        Console.WriteLine("Creating PXE service point role");

        IResultObject pxeServicePoint = connection.CreateInstance("SMS_SCI_SysResUse");
        pxeServicePoint["NALPath"].StringValue = nalPath;
        pxeServicePoint["NALType"].StringValue = "Windows NT Server";
        pxeServicePoint["RoleName"].StringValue = "SMS PXE Service Point";
        pxeServicePoint["SiteCode"].StringValue = siteCode;

        // Get the server from the site code.
        string query = string.Format(
               "Select ServerName From SMS_Site Where SiteCode='{0}'",
               siteCode);
        IResultObject result = connection.QueryProcessor.ExecuteQuery(query);
        foreach (IResultObject resultObj in result)
        {
            serverName = resultObj["ServerName"].StringValue;
         }
         // Create the embedded property and property lists.
        this.WriteScfEmbeddedProperty(pxeServicePoint, "Server Remote Name", 0, serverName, string.Empty);
        this.WriteScfEmbeddedProperty(pxeServicePoint, "BindPolicy", 0, string.Empty, string.Empty);
        this.WriteScfEmbeddedProperty(pxeServicePoint, "IsActive", 1, string.Empty, string.Empty);
        this.WriteScfEmbeddedProperty(pxeServicePoint, "ResponseDelay", 0, string.Empty, string.Empty);
        this.WriteScfEmbeddedPropertyList(pxeServicePoint, "BindExcept", null);

        pxeServicePoint.Put();

        Console.WriteLine("PXE Service Point role created.");
    }
    catch (SmsException e)
    {
        Console.WriteLine("Failed to create PXE service point role: " + e.Message);
        throw;
    }
}

The example method has the following parameters:

Parameter

Type

Description

connection

Managed: WqlConnectionManager

A valid connection to the SMS Provider.

siteCode

Managed: String

The Configuration Manager site code.

nalPath

Managed: String

The NAL path to the PXE service point. For example, ["Display=\\SERVERNAME\"]MSWNET:["SMS_SITE=SITECODE"]\\SERVERNAME\

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 About Securing Configuration Manager Applications.

See Also

Concepts

SMS_SCI_SysResUse Server WMI Class
PackNALPath Method in Class SMS_NAL_Methods
About Operating System Deployment Site Role Configuration
Configuration Manager Operating System Deployment
Configuration Manager Programming Fundamentals
Configuration Manager Site Control File
Operating System Deployment Site Role Configuration
How to Set the Response Delay for a PXE Service Point
How to Set the PXE Service Point Response to Network Interfaces
How to Set the PXE Service Point Response to PXE Requests
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