Page 1 of 1 1
Topic Options
#188914 - 2008-07-29 12:13 PM Getting Computer GUID from AD
Viggen Offline
Starting to like KiXtart

Registered: 2002-03-22
Posts: 110
Hi All!

Been lurking around the forum for quite some time, and now I have a problem I can't seem to solve.

We're using SpecOp at work and the reporting part uses "ComputerGUID" to identify computers, in the form of: ComputerGuid={a2e5c2a7-b017-4012-bc5a-a50158ba2e1f}

I have been trying to find this in AD, but to no avail.
The best I could come up with by using fnLDAPQuery() is "objectGUID", but that returns: §Âå¢↨°↕@¼Z¥☺Xº.▼

Can anyone point me in the right direction?


/Viggen

Top
#188915 - 2008-07-29 12:31 PM Re: Getting Computer GUID from AD [Re: Viggen]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
hi Viggen

What the AD returns is a Byte[] variable.
You have to convert that to a readable string
My UUID2netbootGUID should be able to help you out there.

Top
#188917 - 2008-07-29 12:38 PM Re: Getting Computer GUID from AD [Re: Arend_]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Basically you return should be converted like this:
 Code:
For $i=0 to Len($AdReturnedByte)
  $s=$s+$comma+Right("0"+DecToHex(Asc(SubStr($AdReturnedByte,$i,1))),2)
  $comma = ","
Next

Top
#188923 - 2008-07-29 05:38 PM Re: Getting Computer GUID from AD [Re: Arend_]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Just for good measure and people reading this in the future here's the code:
 Code:
Dim $objSysInfo, $objCompCN, $byteGUID, $strGUID, $strDash, $i
$objSysInfo = CreateObject("ADSystemInfo")
$objCompCN = GetObject("LDAP://"+$objSysInfo.ComputerName)
$byteGUID = $objCompCN.objectGUID

For $i=0 to Len($byteGUID)
  $strGUID=$strGUID+$strDash+Right("0"+DecToHex(Asc(SubStr($byteGUID,$i,1))),2)
  $strDash = "-"
Next
? $strGUID


Now to vice versa this project, that's an entirely different matter.
In that case I do have to refer to my UUID2netbootGUID function as mentioned above.

Keep in mind that the resulting string might not be in the right order as UUID2netbootGUID points out, you might have to flip it around to get it in the right order, just look at the UDF on how to do that.

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 405 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.054 seconds in which 0.025 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org