'32characters long
strGUID = "00000000000000000000000000000005"
objComp.Put "netbootGUID", getGUID(strGUID)
objComp.SetInfo
Function getGUID(sGUID)
For iCount = 1 to Len(sGUID) step 2
aGuid((iCount-1)/2) = "&h" & MID(sGuid, iCount,2)
Next
temp = aGuid(7)
aGuid(7) = aGuid(6)
aGuid(6) = temp
temp = aGuid(5)
aGuid(5) = aGuid(4)
aGuid(4) = temp
temp = aGuid(3)
aGuid(3) = aGuid(0)
aGuid(0) = temp
temp = aGuid(1)
aGuid(1) = aGuid(2)
aGuid(2) = temp
getGUID = ConvertGuid(aGuid)
End Function
Function ConvertGuid(Guid)
'set up the stream as text Latin I
stream.type = 2 ' text
stream.charset = "windows-1252" ' Latin I
stream.open
'the hex character values to write
arhex = Guid
'array(&hfc, &h1c, &h49, &h26, _
' &h50, &h9e, &h57, &h48, _
' &h86, &h1b, &h0c, &hb8, _
' &hdf, &h22, &hb5, &hd7)
's1 is just to display what hex values are in the array
'to be written to the stream
s1 = "" : comma = ""
for i = 0 to ubound(arhex)
s1 = s1 & comma & right("0" & hex(arhex(i)),2)
comma = ","
next
'write the hex chars to the stream as text
for i = 0 to ubound(arhex)
stream.writetext chr(arhex(i))
next
'reposition to the start of the stream
stream.position = 0
'toggle to binary stream
stream.type = 1 ' binary
'read the entire stream as a byte array
octetstring = stream.read
'close the stream since we have what we want...
s2 = "" : comma = ""
stream.close
'prove that we have a byte array
'wscript.echo typename(octetstring) ' Byte() = byte array
'build another display string of the bytes in the byte array
for i = 1 to lenb(octetstring)
s2 = s2 & comma & right("0" & hex(ascb(midb(octetstring,i,1))),2)
comma = ","
next
'display both to prove they match
ConvertGuid = octetstring
End Function