usera Posted January 14, 2011 Share Posted January 14, 2011 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 Link to comment Share on other sites More sharing options...
water Posted January 14, 2011 Share Posted January 14, 2011 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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
usera Posted January 14, 2011 Author Share Posted January 14, 2011 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 Link to comment Share on other sites More sharing options...
usera Posted January 14, 2011 Author Share Posted January 14, 2011 thanks Water,May I have a little bit more?useraMay I know the format?if the domain name is: north.local the group name is: Sales GroupWhat is the format? following one? If _AD_IsMemberOf("north.local\Sales Group",@username) Then or just If _AD_IsMemberOf("Sales Group",@username) Then thanksusera Link to comment Share on other sites More sharing options...
water Posted January 14, 2011 Share Posted January 14, 2011 (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 January 14, 2011 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
usera Posted January 14, 2011 Author Share Posted January 14, 2011 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 exampleIf you can then ...thanksusera Link to comment Share on other sites More sharing options...
usera Posted January 14, 2011 Author Share Posted January 14, 2011 (edited) I got error line 4566 error, please see as attached Edited January 14, 2011 by usera Link to comment Share on other sites More sharing options...
water Posted January 15, 2011 Share Posted January 15, 2011 (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 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 January 15, 2011 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now