The byte array encoding of ADSI SID`s is a real scripting language killer. That`s why someone came up with the script friendly ADsSecurity.dll resource kit component. Its not included with NT5, you can get it from here:

Reskit with ADsSecurity

Once you extract ADsSecurity.dll out of the reskit folder into system32, register it like this:

regsvr32 adssecurity.dll

Then you can use it to give you an ASCII string rep. of the SID:

break on

$adsid = createobject("ADsSid")

if $adsid
 $user = getobject("WinNT://development/shawn.tassie,user")
 if $user
  $= $adsid.setas(5,$user.adspath)
  $sid = $adsid.getas(1)
  ?"sid=" $sid
 endif
endif

exit 1


-Shawn