Sign in to follow this  
Followers 0
usera

Check domain user is member of

8 posts in this topic

Greeting,

I have to create an EXE file to do the following task.

Domain (north.local) User run this EXE file, if He / She is a member of "Sales Group", then show message. if not then just quit

I did some research, somebody said that use

_AD_IsMemberOf

Really do not know how to do that.

Can some one give me the help?

Thanks!

Usera

Share this post


Link to post
Share on other sites



The AD UDF comes with a help file and an example for every function.

_AD_IsMemberOf is quite easy. Pass userid and groupname to the function.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

The AD UDF comes with a help file and an example for every function.

_AD_IsMemberOf is quite easy. Pass userid and groupname to the function.

thanks Water,

May I have a little bit more?

usera

Share this post


Link to post
Share on other sites

thanks Water,

May I have a little bit more?

usera

May I know the format?

if the domain name is: north.local

the group name is: Sales Group

What is the format? following one?

If _AD_IsMemberOf("north.local\Sales Group",@username) Then

or just

If _AD_IsMemberOf("Sales Group",@username) Then

thanks

usera

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Did you have a look in the help file? It clearly describes the format and order of the parameters.

The example script shows how to use the function in a script.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Did you have a look in the help file? It clearly describes the format and order of the parameters.

The example script shows how to use the function in a script.

Sorry, newbie reason for ask here is not understood enough from the example

If you can then ...

thanks

usera

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I got error

line 4566 error, please see as attached

Edited by usera

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

The attachement is missing!

To improve the example and help files I would like to know why you "not understood enough from the example"?

Is the example too complex? Is something missing? Or is it just you being a bit too lazy :x

Please use the following example to check membership in a group:

#include <AD.au3>
; Open Connection to the Active Directory
_AD_Open()

$sFQDN_User = @UserName
$sFQDN_Group = "Sales Group"

; Check the group membership of the specified user for the specified group
$iResult = _AD_IsMemberOf($sFQDN_Group, $sFQDN_User)
Select
    Case $iResult = 1
        MsgBox(64, "Active Directory Functions", _
                "User: " & $sFQDN_User & @CRLF & _
                "Group: " & $sFQDN_Group & @CRLF & _
                "User is a member of the specified group!")
    Case ($iResult = 0 And @error = 1)
        MsgBox(64, "Active Directory Functions", _
                "User: " & $sFQDN_User & @CRLF & _
                "Group: " & $sFQDN_Group & @CRLF & _
                "Group does not exist!")
    Case ($iResult = 0 And @error = 2)
        MsgBox(64, "Active Directory Functions", _
                "User: " & $sFQDN_User & @CRLF & _
                "Group: " & $sFQDN_Group & @CRLF & _
                "User does not exist!")
    Case ($iResult = 0)
        MsgBox(64, "Active Directory Functions", _
                "User: " & $sFQDN_User & @CRLF & _
                "Group: " & $sFQDN_Group & @CRLF & _
                "User is a not member of the specified group!")
EndSelect

; Close Connection to the Active Directory
_AD_Close()
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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