vbscript getobject function

Post Reply
User avatar
AlexSchaft
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

vbscript getobject function

Post 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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

VB's GetObject is functionally equivalent to xHarbour's

try
getactiveobject()
catch
createobject()
end
Regards

G. N. Rao.
Hyderabad, India
Post Reply