Microsoft KB Archive/302467

= How to prestage an RIS client computer by using ADSI =

Article ID: 302467

Article Last Modified on 8/4/2006

-

APPLIES TO


 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Active Directory Service Interfaces 2.5
 * Microsoft Active Directory Service Interfaces 2.5

-



This article was previously published under Q302467



INTRODUCTION
The netbootGUID attribute of a computer object in Active Directory is set to either the computer's GUID, if available, or a calculated value based on the network card address for a computer that has been enabled to use Remote Installation Services (RIS). The netbootGUID attribute is set during the client computer's prestaging phase. By using Active Directory Services Interface (ADSI), the client computer can be programmatically prestaged by setting the computer object's netbootGUID attribute in Active Directory.



MORE INFORMATION
When a RIS client computer on the network starts up it initiates a network service request. The RIS server (using the Boot Information Negotiation Layer [BINL] service) must check Active Directory for the existence of a prestaged client computer account that matches the client computer. BINL checks for the existence of a client computer by querying Active Directory for a computer object whose netbootGUID matches the GUID sent during the request.

The samples provided in this section demonstrate:
 * How to programmatically prestage client computers by setting the netbootGUID attribute in Active Directory.
 * How to determine what the netbootGUID attribute should be set to.

Programmatically Prestage the Client
The following sample uses Microsoft Visual Basic to demonstrate how to programmatically prestage the client computer by setting the octet string value of the netbootGUID attribute on the computer object in Active Directory.

'Here is an example of using the CLSIDFromString function to set 'netbootGUID attribute on an existing computer object. 'You can also set netbootGUID at the creation time of the computer object

Private Declare Function CLSIDFromString _ Lib &quot;ole32.dll&quot; (ByVal lpszProgID As Long, _                   pCLSID As Byte) As Long

Private Sub Form_Load Dim oComp As IADs Dim retval As Long Dim strGUID As String Dim pGUID(0 To 15) As Byte

strGUID = &quot;{EEF00083-8597-4c2c-9ACB-FC860480FC5D}&quot; retval = CLSIDFromString(StrPtr(strGUID), pGUID(0)) Set oComp = GetObject(&quot;LDAP://cn=comp1,cn=computers,dc=mydomain,dc=com&quot;) oComp.Put &quot;netbootGUID&quot;, CVar(pGUID) oComp.SetInfo Set oComp = nothing End Sub

Programmatically Determine NetbootGUID Value
The following sample uses Microsoft Visual Basic Script to demonstrate how to programmatically determine what the netbootGUID attribute value should be set to for a computer.

'The sample uses WMI to return the UUID on the system. 'If a UUID can not be found on the system it returns all F's. 'What RIS does in this case is it uses a zero'd out version of the MAC 'address of the NIC the machine is booting off of. 'This sample will return the value required to set the 'netbootGUID attribute

Option Explicit

Dim boolWFMCapable Dim szUUID Dim szMac Dim SystemSet Dim szAdapterDescription Dim SystemItem Dim NetworkAdapterSet Dim NetworkAdapter Dim iMacCount Set SystemSet = GetObject(&quot;winmgmts:&quot;).InstancesOf (&quot;Win32_ComputerSystemProduct&quot;) For Each SystemItem In SystemSet szUUID = SystemItem.UUID If szUUID = &quot;FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF&quot; Then MsgBox &quot;No system UUID could be found. This system does &quot; & _ &quot;not appear to support Intel's Wired For Management &quot; & _ &quot;specification. This script will now try and retrive &quot; & _ &quot;a MAC based UUID.&quot;, vbInformation, &quot;Not WFM capable&quot; boolWFMCapable = 0 Else InputBox &quot;Successfully retrieved a system UUID, &quot; & szUUID & _ &quot;. This UUID has been placed in the text area below &quot; & _ &quot;for your convenience.&quot;, &quot;WFM Capable&quot;, szUUID boolWFMCapable = 1 End If Next If boolWFMCapable = 0 Then Set NetworkAdapterSet = GetObject(&quot;winmgmts:&quot;).InstancesOf (&quot;Win32_NetworkAdapter&quot;) iMACCount = 0 For Each NetworkAdapter In NetworkAdapterSet If NetworkAdapter.AdapterType = &quot;Ethernet 802.3&quot; Then szAdapterDescription = NetworkAdapter.Description If NetworkAdapter.Description <> &quot;Packet Scheduler Miniport&quot; Then szMAC = NetworkAdapter.MACAddress szUUID = &quot;00000000-0000-0000-0000-&quot;&Replace(szMAC, &quot;:&quot;, &quot;&quot;) InputBox &quot;Based on the network adapter with the description &quot;&quot;&quot; & _ szAdapterDescription & &quot;&quot;&quot;, your system's UUID would &quot; & _ &quot;be &quot; & szUUID & &quot;. This UUID has been placed in the &quot; & _ &quot;text area below for your convenience.&quot;, _ &quot;Not WFM Capable&quot;, szUUID End If    End If    iMACCount = iMACCount + 1 Next End If

