omicronx9 Posted August 18, 2008 Share Posted August 18, 2008 (edited) Hello Is there a way in Autoit to check a users groups membership similar to the kix opertation ingroup ? EG : If InGroup("mygroup") then Thanks in advance Edited August 18, 2008 by omicronx9 Link to comment Share on other sites More sharing options...
water Posted August 18, 2008 Share Posted August 18, 2008 Yes there is. Please have a look at the AD function library 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...
omicronx9 Posted August 18, 2008 Author Share Posted August 18, 2008 Yes there is. Please have a look at the AD function libraryThanks for the prompt reply forgive me for a stupid question:Here is the script i wish to use the ad library with essenstially all this works i just need to figure out how to reference the AD stuff.The requirement is to check if the user is in a group then execute based on there combo box selection.How do i reference the call to ismemberof ?#include <GuiConstants.au3>#include <adfunctions.au3>Dim $OFFICE, $CCOffice, $okbutton, $CancelButton, $Path, $CHOME, $WindowsFolder, $ProgramFolder,Dim $ProgressBar1, $Sol6, $Version, $OSVersion, $Username$Version = "Insolvency CORE Change Office v1.0"$OSVersion = EnvGet("Deployos")$UserName = EnvGet("Username")$DefaultOffice = EnvGet("Office")$WindowsFolder = EnvGet("HomeDrive") & EnvGet("HomePath") & "Windows"Opt("GUIOnEventMode", 1) ; Change to OnEvent mode ; GUIGuiCreate($Version, 250, 100)GUISetState(@SW_SHOW)GuiSetIcon("ipssql.exe", 0); COMBO$SelectOffice = GUICtrlCreateCombo ("Pick an Office", 10,10) ; create first itemGUICtrlSetData(-1,"CORE Canberra|CORE Perth|CORE Sydney|CORE Melbourne|CORE Wagga Wagga|","Pick A Office") GUICtrlSetFont (-1,9, 400, "Arial")$okbutton = GUICtrlCreateButton ("OK", 10, 35 , 40, 25)GUICtrlSetOnEvent($okbutton, "OKButton")$Cancelbutton = GUICtrlCreateButton ("Exit", 55, 35, 40 , 25)GUICtrlSetOnEvent($CancelButton, "Closebutton")GUISetState(@SW_SHOW)While 1 Sleep(20000) ; Idle aroundWEndFunc OKButton() $Office = GUICtrlRead($SelectOffice) Select Case $Office = "CORE Canberra" If IsMemberof ("Canberra Core Insolvency Shared MUsers", &) Then $CCOffice = "Canberra_Core" DriveMapDel("F:") sleep(1000) DriveMapAdd("F:", "\\pdcdb02\" & $CCOffice & "$") GUICtrlCreateLabel("Session set for " & $Office ,10,75,200,20) Else GUICtrlCreateLabel("You Do Not have Permission to Access " & $Office ,10,75,200,20) EndIf Case $Office = "CORE Perth" If ingroup ("Perth Core Insolvency Shared MUsers") Then $CCOffice = "Perth_Core" DriveMapDel("F:") sleep(1000) DriveMapAdd("F:", "\\pdcdb02\" & $CCOffice & "$") GUICtrlCreateLabel("Session set " & $Office ,10,75,200,20) Else GUICtrlCreateLabel("You Do Not have Permission to Access " & $Office ,10,75,200,20) ENDIF Case $Office = "CORE Sydney" If ingroup ("Sydney Core Insolvency Shared MUsers") Then $CCOffice = "Sydney_Core" DriveMapDel("F:") sleep(1000) DriveMapAdd("F:", "\\pdcdb02\" & $CCOffice & "$") GUICtrlCreateLabel("Session set for " & $Office ,10,75,200,20) Else GUICtrlCreateLabel("You Do Not have Permission to Access " & $Office ,10,75,200,20) EndIf Case $Office = "CORE Wagga Wagga" If ingroup ("Sydney Core Insolvency Shared MUsers") Then $CCOffice = "Wagga_Core" DriveMapDel("F:") sleep(1000) DriveMapAdd("F:", "\\pdcdb02\" & $CCOffice & "$") GUICtrlCreateLabel("Session set for " & $Office ,10,75,200,20) Else GUICtrlCreateLabel("You Do Not have Permission to Access " & $Office ,10,75,200,20) EndIf Case Else MsgBox(0, "", "You didn't select an office") EndSelectEndFuncFunc Closebutton() ExitEndFunc Link to comment Share on other sites More sharing options...
water Posted August 20, 2008 Share Posted August 20, 2008 Hi omicronx9, to check if a User is member of a group I use something like (this example checks if the logged on user is member of group xyz): If _ADIsMemberOf(_ADSamAccountNametoFQDN("xyz"),_ADSamAccountNametoFQDN(@UserName)) Then According to the AD UDF you need the FQDN (full qualified domain name). 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