In Microsoft System Center Configuration Manager 2007 you serialize a certificate from a PFX file by calling the PxeAuthClass Client COM Automation Class IPxeAuthClass::ReadIdentity Method method.

ReadIdentity has the following parameters:

Parameter Description

FileName

The path and filename of the PFX file.

FilePassword

The PFX file password.

SMSID

The PXE certificate identifier.

ReadIdentity returns an array containing the following:

Element Description

0

The hexadecimal-encoded private key for the PFX file containing the certificate.

1

The hexadecimal-encoded certificate.

After you obtain the array, you can use it to submit a registration record by using the SMS_Site class SubmitRegistrationRecord method.

To serialize a certificate from a PFX file

  1. Create an instance of the PxeAuthClass Client COM Automation Class class.

  2. Call the ReadIdentity method.

Example

The following example reads a certificate from a file identified by fileName.

For information about calling the sample code, see How to Call Configuration Manager COM Automation Objects.

Visual Basic Script  Copy Code
Sub SerializeCertFromPFX (fileName, password, smsID)


	Dim pxeauth
	Set pxeauth = CreateObject("Microsoft.ConfigMgr.PXEAuth")

   
	' Serialize certificate from PFX file.


	Dim ident

	ident= pxeauth.ReadIdentity( fileName, password, smsID)
	WScript.Echo "certificatePFX = " & ident(0)
	WScript.Echo "certificate	= " & ident(1)

End Sub

The example method has the following parameters:

Parameter Type Description

fileName

  • VBScript: String

The name and path for the PFX file. For example, \\SERVERNAME\c$\SelfSigned.pfx.

password

  • VBScript: String

The PFX file password.

smsID

  • VBScript: String

The PXE certificate identifier.

Compiling the Code

Platforms

Windows Server 2003

To use PXEAuthClass with C# you will need the following:

Namespaces

System

System.Collections.Generic

System.Text

System.Threading

TsMediaLib

Assembly

You will need to use COM interop to access the TSMediaClass object. The COM object you add a reference to is TSMedia 1.0 Type Library.

To declare in your code, using PxeAuthClassClass.

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


Send comments about this topic to Microsoft.