Page 1 of 1

vbscript getobject function

Posted: Tue Dec 18, 2007 10:03 am
by AlexSchaft
Hi,

Found the below on the xhb newsgroup, but can't seem to translate the Getobject call. Does anybody know of an alternative way to get domain info, not necessarily AD, could be Linux+Samba too.

Code: Select all

Function VerifyGroupMembers( strDomain, strGroup, strMemberList )

    VerifyGroupMembers = False
    Set objGroup = GetObject("WinNT://" & strDomain & "/" & strGroup & 
",group")

    arrUsers = Split( strMemberList, "," )

    For Each objUser In objGroup.Members

        WScript.Echo "Checkiing group member " & objUser.Name

        bMemberFound = False

        For i = 0 To UBound( arrUsers )
         If( UCase( Trim( arrUsers(i) ) ) = UCase( Trim( objUser.Name ) ) ) 
Then
          WScript.Echo "Member found: " & objUser.Name
             bMemberFound = True
             Exit For
         End If
     Next

     If( Not bMemberFound ) Then
         WScript.Echo "Member NOT found: " & objUser.Name
         VerifyGroupMembers = False
         Exit Function
     End If
    Next

    VerifyGroupMembers = True
End Function

Re: vbscript getobject function

Posted: Tue Dec 18, 2007 10:11 am
by Enrico Maria Giordano
Try using CreateObject() instead.

EMG

Posted: Tue Dec 18, 2007 10:50 am
by nageswaragunupudi
VB's GetObject is functionally equivalent to xHarbour's

try
getactiveobject()
catch
createobject()
end