How to prestage an RIS client computer by using ADSI

This article was previously published under Q302467
This article has been archived. It is offered "as is" and will no longer be updated.
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.

Code Samples

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 objectPrivate Declare Function CLSIDFromString _    Lib "ole32.dll" (ByVal lpszProgID As Long, _                    pCLSID As Byte) As LongPrivate Sub Form_Load()  Dim oComp As IADs  Dim retval As Long  Dim strGUID As String  Dim pGUID(0 To 15) As Byte  strGUID = "{EEF00083-8597-4c2c-9ACB-FC860480FC5D}"  retval = CLSIDFromString(StrPtr(strGUID), pGUID(0))  Set oComp = GetObject("LDAP://cn=comp1,cn=computers,dc=mydomain,dc=com")  oComp.Put "netbootGUID", CVar(pGUID)  oComp.SetInfo   Set oComp = nothingEnd 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 attributeOption ExplicitDim boolWFMCapableDim szUUIDDim szMacDim SystemSetDim szAdapterDescriptionDim SystemItemDim NetworkAdapterSetDim NetworkAdapterDim iMacCount Set SystemSet = GetObject("winmgmts:").InstancesOf ("Win32_ComputerSystemProduct") For Each SystemItem In SystemSet  szUUID = SystemItem.UUID  If szUUID = "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF" Then    MsgBox "No system UUID could be found. This system does " & _           "not appear to support Intel's Wired For Management " & _           "specification. This script will now try and retrive " & _           "a MAC based UUID.", vbInformation, "Not WFM capable"    boolWFMCapable = 0  Else    InputBox "Successfully retrieved a system UUID, " & szUUID & _             ". This UUID has been placed in the text area below " & _             "for your convenience.", "WFM Capable", szUUID    boolWFMCapable = 1  End IfNext If boolWFMCapable = 0 Then  Set NetworkAdapterSet = GetObject("winmgmts:").InstancesOf ("Win32_NetworkAdapter")   iMACCount = 0  For Each NetworkAdapter In NetworkAdapterSet    If NetworkAdapter.AdapterType = "Ethernet 802.3" Then      szAdapterDescription = NetworkAdapter.Description      If NetworkAdapter.Description <> "Packet Scheduler Miniport" Then        szMAC = NetworkAdapter.MACAddress        szUUID = "00000000-0000-0000-0000-"&Replace(szMAC, ":", "")        InputBox "Based on the network adapter with the description """ & _                 szAdapterDescription & """, your system's UUID would " & _                 "be " & szUUID & ". This UUID has been placed in the " & _                 "text area below for your convenience." , _<BR/>                 "Not WFM Capable", szUUID      End If     End If    iMACCount = iMACCount + 1  NextEnd If				
REFERENCES
For more information about ADSI, visit the following Microsoft Web site:For more information on remote installation services, visit the following Microsoft Web sites:For more information on how to programmatically determine the computer's GUID, click the following article number to view the article in the Microsoft Knowledge Base:
198871 IShellFolder::GetDisplayNameOf returns names with GUIDs
For more information on how the computer's GUID is generated by the remote installation boot disk, click the following article number to view the article in the Microsoft Knowledge Base:
242920 How the Remote Installation Boot disk works
For more information on CLSIDFromString, visit the following Microsoft Developer Network (MSDN) Web site:For more information, click the following article number to view the article in the Microsoft Knowledge Base:
183544 How to call CLSID and ProgID related COM APIs in Visual Basic
For an overview of WMI, visit the following MSDN Web site:
Properties

Article ID: 302467 - Last Review: 12/06/2015 03:32:54 - Revision: 5.1

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

  • kbnosurvey kbarchive kbdswadsi2003swept kbhowto KB302467
Feedback