How to prestage an RIS client computer by using ADSI (302467)
The information in this article applies to:
- Microsoft Windows 2000 Server
- Microsoft Windows 2000 Advanced Server
- Microsoft Active Directory Services Interface, System Component
- Microsoft Active Directory Services Interface, Microsoft Active Directory Client
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.
Code SamplesProgrammatically 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 "ole32.dll" (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 = "{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 = 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("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 If
Next
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
Next
End 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:
Modification Type: | Major | Last Reviewed: | 8/4/2006 |
---|
Keywords: | kbDSWADSI2003Swept kbhowto KB302467 kbAudDeveloper |
---|
|