Jump to content

check AD group membership If ingroup("mygroup")


Recommended Posts

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 - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Yes there is. Please have a look at the AD function library

Thanks 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

; GUI

GuiCreate($Version, 250, 100)

GUISetState(@SW_SHOW)

GuiSetIcon("ipssql.exe", 0)

; COMBO

$SelectOffice = GUICtrlCreateCombo ("Pick an Office", 10,10) ; create first item

GUICtrlSetData(-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 around

WEnd

Func 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")

EndSelect

EndFunc

Func Closebutton()

Exit

EndFunc

Link to comment
Share on other sites

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 - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...