Sign in to follow this  
Followers 0
Elias Araujo

Users Groups...

8 posts in this topic

Hi!!!!

How I can know if an user is member of some group? There is a Isadmin() function, but it does not look for in specific groups. Example... I want to know if Paul is member of the group abcd.

Please, help-me...

Thanks...

Share this post


Link to post
Share on other sites



Hi!!!!

How I can know if an user is member of some group? There is a Isadmin() function, but it does not look for in specific groups. Example... I want to know if Paul is member of the group abcd.

Please, help-me...

Thanks...

From the CMD line, the following will list the members of the local group: NET LOCALGROUP "abcd"

Add /DOMAIN to the end to list a group in your domain.

:think:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

From the CMD line, the following will list the members of the local group: NET LOCALGROUP "abcd"

Add /DOMAIN to the end to list a group in your domain.

:think:

OK... But in this case I will have to process this reply. Exists something that makes this in the Autoit directly?

thanks.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

OK... But in this case I will have to process this reply. Exists something that makes this in the Autoit directly?

thanks.

Have you written any AutoIT code at all yet, or looked at RunWait() in the help file? I'm sure we can get you there but you are going to have to start it off with whatever you already have. Setup a CMD line that runs the NET command, pipe it to a FIND command for your username. RunWait() will return the %ErrorLevel% from the CMD line (0=username found).

You can also do some COM OBJ calls to the local user manager, which have been discussed elsewhere, if you know how to do that.

I'm sorry if that was condecending and beneath your experience level, but you haven't told us what you have already tried or shown any code at all yet... :think:

You'll find there is a lot of resistance on this board to simply writing your script for you. But the people here will put tremendous effort into helping you figure it out and troubleshoot/improve your own scipt. :-)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

I was using Kix Script and am initiating in the AutoIt3. I made some translations of Kix - > Autoit3 but I found this difficulty in the groups. I am thinking about using AutoIt + VBScript to decide this.... As the VBScript offers support to Active Directory I think that it is a way to find the solution.

Share this post


Link to post
Share on other sites

I was using Kix Script and am initiating in the AutoIt3. I made some translations of Kix - > Autoit3 but I found this difficulty in the groups. I am thinking about using AutoIt + VBScript to decide this.... As the VBScript offers support to Active Directory I think that it is a way to find the solution.

Check out thread #23470, in which the COM object for user admin is called in an example from JdeB. Although not specificly the call for AD groups, it shows you how that is done in AutoIT.

:think:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Here's what I've been using for a while (without problems). I stole bits and pieces from another post in this forum.

$handle = PluginOpen("C:\InGroup.dll")
    ;Checks to see if user is in MISStaff group.  If they are, then drive M is mapped (to Server)   
     If InGroup("MISStaff") Then
     DriveMapAdd("M:", "\\server\MISPublic", 0)
     EndIf
PluginClose($handle)

Search the forum for the "InGroup.dll" that someone created (not sure who it was). I put the dll on each workstation (through a login script).

Hope this helps!


Roger O."When people show you who they are, believe them.” --Mark Twain

Share this post


Link to post
Share on other sites

Check out thread #23470, in which the COM object for user admin is called in an example from JdeB. Although not specificly the call for AD groups, it shows you how that is done in AutoIT.

:think:

Here is another one just to check if a userid is in a group:

$oMyError = ObjEvent("AutoIt.Error", "ComError")
msgbox(0,"Validate",UserInGroup(@LogonDomain,"usernamer","groupname"))
Exit
; Check Valid User/Pasword and optionally in a group 
Func UserInGroup($Domain, $UserName, $InGroup)
    Local $objUser = ObjGet("WinNT://" & $Domain & "/" & $UserName)
    For $oGroup in $objUser.Groups
        If $oGroup.Name = $InGroup Then 
            Return 1
        EndIf
    Next
    Return 0
EndFunc 
;COM Error function
Func ComError()
    If IsObj($oMyError) Then
        $HexNumber = Hex($oMyError.number, 8)
        SetError($HexNumber)
    Else
        SetError(1)
    EndIf
    Return 0
EndFunc  ;==>ComError

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0