vbscript getobject function

vbscript getobject function

Postby AlexSchaft » Tue Dec 18, 2007 10:03 am

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  Expand view  RUN
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
AlexSchaft
 
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

Re: vbscript getobject function

Postby Enrico Maria Giordano » Tue Dec 18, 2007 10:11 am

Try using CreateObject() instead.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8716
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby nageswaragunupudi » Tue Dec 18, 2007 10:50 am

VB's GetObject is functionally equivalent to xHarbour's

try
getactiveobject()
catch
createobject()
end
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 45 guests