create computer in AD and add GUID to it

Author Message
antun

  • Total Posts : 9
  • Scores: 0
  • Reward points : 0
  • Joined: 4/20/2005
  • Location:
  • Status: offline
create computer in AD and add GUID to it Monday, May 16, 2005 7:31 PM (permalink)
0
Hey, i am able to add a computer to AD, but cannot add the GUID to it for remote installations.

i am using

[CODE]
strGUID = "{00000000-0000-0000-0000-000000000001}"
objComp.Put "netbootGUID", strGUID
[/CODE]

but it comes up with an error, i was reading that the string needs to be converted to an octet string or something? how would i do that?

this is using vbscript


thanks
 
#1
    antun

    • Total Posts : 9
    • Scores: 0
    • Reward points : 0
    • Joined: 4/20/2005
    • Location:
    • Status: offline
    Re: create computer in AD and add GUID to it Tuesday, May 17, 2005 2:24 PM (permalink)
    0
    Ok i found a function that makes it work

    [CODE]
    '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
    [/CODE]
     
    #2

      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 1 guests.

      Icon Legend and Permission

      • New Messages
      • No New Messages
      • Hot Topic w/ New Messages
      • Hot Topic w/o New Messages
      • Locked w/ New Messages
      • Locked w/o New Messages
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2012 ASPPlayground.NET Forum Version 3.9