anyone had problems with these? I've verified that my computer IS in Domain Computers and both of these functions return false. Anyone know why?

Code:
$domain = 'microsoft.com'

If ComputerInGroup('Domain Computers') = 1
"true"
Else
? "CID false" +@ERROR +@SERROR
Endif

If fnInGroupAD('Domain Computers',1)
"true"
Else
? "FN false" +@ERROR +@SERROR
Endif

get $


Function ComputerInGroup($group,optional $Domain)
Dim $oGrp
if not $domain $domain=@domain endif
$oGrp = GetObject("WinNT://" + $domain + "/" + $group + ",group" )
if @error exit 1 endif

if $oGrp.IsMember("WinNT://" + $domain + "/" + @wksta + "$$" )
$ComputerInGroup=1
else
$ComputerInGroup=0
endif
endfunction

Function fnInGroupAD($sGroup,Optional $bComputer)
Dim $objSys,$objTarget,$aMemberOf,$sMemberOf
$objSys = CreateObject("ADSystemInfo")
$objTarget = GetObject("LDAP://"+Iif($bComputer,$objSys.ComputerName,$objSys.UserName))
$aMemberOf = $objTarget.GetEx("memberOf")
For Each $sMemberOf in $aMemberOf
If InStr($sMemberOf,"CN="+$sGroup+",")
$fnInGroupAD = Not 0
Exit
EndIf
Next
$fnInGroupAD = NOT 1
EndFunction



Edit: both return false.
Edit2: added functions so you could see the versions I'm using.


Edited by thepip3r (2006-02-16 04:08 AM)