skippynz Posted October 6, 2006 Share Posted October 6, 2006 Hi all - does anyone know how to enumerate the list of group names from AD ? i dont really know where to start Link to comment Share on other sites More sharing options...
cppman Posted October 6, 2006 Share Posted October 6, 2006 AD? Can you be a bit more specific? Miva OS Project Link to comment Share on other sites More sharing options...
skippynz Posted October 6, 2006 Author Share Posted October 6, 2006 (edited) AD? Can you be a bit more specific? sure - im wanting to script that does the following 1) read an ini file for button names and Active Directory OU info 2) display a gui using this info above to create buttons 3) user clicks a button and it will display in a listview the groups that are in this OU 4) user can then click the group name in the list and press a button to export the list of users in that group to a txt file i have the part that will export the users - taken from a script on the forums here.... but not sure how to edit the script to export the group list then doing the list is another story expandcollapse popup#include <GuiConstants.au3> ; Setup the Gui and Label GuiCreate("Active Directory Exporter", 400, 305,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $QUESTION = GuiCtrlCreateLabel('Please press the button that corresponds to the OU that you would like to export the data from.', 12, 5, 390,30 ) ; Read in the OU Names and Button Names from ADGroups.ini $BUTTON_01 = IniReadSection ( "ADGroups.ini", "BUTTON01" ) $BUTTON_02 = IniReadSection ( "ADGroups.ini", "BUTTON02" ) $BUTTON_03 = IniReadSection ( "ADGroups.ini", "BUTTON03" ) $BUTTON_04 = IniReadSection ( "ADGroups.ini", "BUTTON04" ) $BUTTON_05 = IniReadSection ( "ADGroups.ini", "BUTTON05" ) $BUTTON_06 = IniReadSection ( "ADGroups.ini", "BUTTON06" ) $BUTTON_07 = IniReadSection ( "ADGroups.ini", "BUTTON07" ) $BUTTON_08 = IniReadSection ( "ADGroups.ini", "BUTTON08" ) $BUTTON_09 = IniReadSection ( "ADGroups.ini", "BUTTON09" ) $BUTTON_10 = IniReadSection ( "ADGroups.ini", "BUTTON10" ) ; Create the Buttons $BUTTON_01_OU_NAME = $BUTTON_01[1][1] $BUTTON_01_BUTTON_NAME = $BUTTON_01[2][1] if $BUTTON_01_OU_NAME <> "" Then $BUTTON01 = GuiCtrlCreateButton($BUTTON_01_BUTTON_NAME, 5, 40, 190, 20) EndIf $BUTTON_02_OU_NAME = $BUTTON_02[1][1] $BUTTON_02_BUTTON_NAME = $BUTTON_02[2][1] if $BUTTON_02_OU_NAME <> "" Then $BUTTON02 = GuiCtrlCreateButton($BUTTON_02_BUTTON_NAME, 5, 60, 190, 20) EndIf $BUTTON_03_OU_NAME = $BUTTON_03[1][1] $BUTTON_03_BUTTON_NAME = $BUTTON_03[2][1] if $BUTTON_03_OU_NAME <> "" Then $BUTTON03 = GuiCtrlCreateButton($BUTTON_03_BUTTON_NAME, 5, 80, 190, 20) EndIf $BUTTON_04_OU_NAME = $BUTTON_04[1][1] $BUTTON_04_BUTTON_NAME = $BUTTON_04[2][1] if $BUTTON_04_OU_NAME <> "" Then $BUTTON04 = GuiCtrlCreateButton($BUTTON_04_BUTTON_NAME, 5, 100, 190, 20) EndIf $BUTTON_05_OU_NAME = $BUTTON_05[1][1] $BUTTON_05_BUTTON_NAME = $BUTTON_05[2][1] if $BUTTON_05_OU_NAME <> "" Then $BUTTON05 = GuiCtrlCreateButton($BUTTON_05_BUTTON_NAME, 5, 120, 190, 20) EndIf $BUTTON_06_OU_NAME = $BUTTON_06[1][1] $BUTTON_06_BUTTON_NAME = $BUTTON_06[2][1] if $BUTTON_06_OU_NAME <> "" Then $BUTTON06 = GuiCtrlCreateButton($BUTTON_06_BUTTON_NAME, 5, 140, 190, 20) EndIf $BUTTON_07_OU_NAME = $BUTTON_07[1][1] $BUTTON_07_BUTTON_NAME = $BUTTON_07[2][1] if $BUTTON_07_OU_NAME <> "" Then $BUTTON07 = GuiCtrlCreateButton($BUTTON_07_BUTTON_NAME, 5, 160, 190, 20) EndIf $BUTTON_08_OU_NAME = $BUTTON_08[1][1] $BUTTON_08_BUTTON_NAME = $BUTTON_08[2][1] if $BUTTON_08_OU_NAME <> "" Then $BUTTON08 = GuiCtrlCreateButton($BUTTON_08_BUTTON_NAME, 5, 180, 190, 20) EndIf $BUTTON_09_OU_NAME = $BUTTON_09[1][1] $BUTTON_09_BUTTON_NAME = $BUTTON_09[2][1] if $BUTTON_09_OU_NAME <> "" Then $BUTTON09 = GuiCtrlCreateButton($BUTTON_09_BUTTON_NAME, 5, 200, 190, 20) EndIf $BUTTON_10_OU_NAME = $BUTTON_10[1][1] $BUTTON_10_BUTTON_NAME = $BUTTON_10[2][1] if $BUTTON_10_OU_NAME <> "" Then $BUTTON10 = GuiCtrlCreateButton($BUTTON_10_BUTTON_NAME, 5, 220, 190, 20) EndIf ; Create the Save / Save and Open Radio Buttons $SAVE1 = GuiCtrlCreateRadio("Save", 10, 260, 100, 20) $OPEN1 = GuiCtrlCreateRadio("Save and Open", 10 ,280, 100, 20) ; Setting the Save Option to be Default GUICtrlSetState ( $SAVE1, $GUI_CHECKED ) GUICtrlSetState ( $OPEN1, $GUI_UNCHECKED ) ;~ ------------------------------------------------------------------------------------------------ ;~ ------------------------------------------------------------------------------------------------ ; Run the Gui GuiSetState() While 1 $msg = GuiGetMsg() Select ; If X is pressed Close the Gui and Exit the Script Case $msg = $GUI_EVENT_CLOSE ExitLoop ; Set the defaults for Auckland OU and check what save option has been set Case $msg = $BUTTON01 $OU = $BUTTON_01_OU_NAME $SAVE = GUICtrlRead ( $SAVE1 ) $OPEN = GUICtrlRead ( $OPEN1 ) Groups() $LIST = GUICtrlCreateList ( "Please select an OU...", 205, 40 , 190 , 255 ) EndSelect WEnd Exit ;~ EndFunc Func Groups() ;~ ------------------------------------------------------------------------------------------------ ;~ ------------------------------------------------------------------------------------------------ ; Bind to Active Directory; $objRootDSE = ObjGet("LDAP://RootDSE") $strDNSDomain = $objRootDSE.Get("DefaultNamingContext") ; Get Usernames from the group specified in the gui $objGroup = ObjGet ("LDAP://"& $OU & $strDNSDomain ) $objGroup.getInfo() $adminlist = "" $arrMemberOf = ("MemberOf") For $strMember in $arrMemberOf $user = ObjGet ("LDAP://"&$strMember) if isobj($user) Then $adminlist &= $user.sAMAccountName & @crlf Next ;~ ------------------------------------------------------------------------------------------------ ;~ ------------------------------------------------------------------------------------------------ EndFunc here is the ini file im reading in #~ Create your buttons 01 to 10 using the example below #~ #~ [EXAMPLE] #~ OUNAME=OU=GROUPNAME,OU=CITY,OU=COUNTRY, #~ BUTTONNAME=Auckland [BUTTON01] OUNAME=OU=GROUPNAME,OU=CITY,OU=COUNTRY, BUTTONNAME=ButtonName Edited December 4, 2007 by craig.gill Link to comment Share on other sites More sharing options...
skippynz Posted October 6, 2006 Author Share Posted October 6, 2006 (edited) the part i dont know how to edit is the bit between the double lines..... Edited October 9, 2006 by craig.gill Link to comment Share on other sites More sharing options...
skippynz Posted October 9, 2006 Author Share Posted October 9, 2006 ive just found a vbs script that pretty much does what i want it too do - is there anyone out there that can help me convert it to autoit script ??? 'Global variables Dim oContainer Dim OutPutFile Dim FileSystem 'Initialize global variables Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject") Set OutPutFile = FileSystem.CreateTextFile("marketing.txt", True) Set oContainer=GetObject("LDAP://OU=groups,OU=test,DC=testdomain,DC=com") 'Enumerate Container EnumerateGroups oContainer 'Clean up OutPutFile.Close Set FileSystem = Nothing Set oContainer = Nothing WScript.Echo "Finished" WScript.Quit(0) Sub EnumerateGroups(oCont) Dim ogroup For Each ogroup In oCont Select Case LCase(ogroup.Class) Case "group" If Not IsEmpty(ogroup.distinguishedName) Then OutPutFile.WriteLine ogroup.Name End If Case "organizationalunit", "container" EnumerateGroups ogroup End Select OutPutFile.WriteLine Next End Sub the current output of the file is - which i can modify to suit my needs but how the heck do i convert the above to autoit ???? CN=test1 CN=test2 CN=test3 CN=test4 Thanks Craig Link to comment Share on other sites More sharing options...
arcker Posted October 9, 2006 Share Posted October 9, 2006 (edited) Hi man, here is some code to extract all of the groups of your ADs I'm using it for define all of the rights of the user ^^ Local $strCN, $strcat, $usercontrol Local $strdistinguishedName Local $objCommand = ObjCreate("ADODB.Command") Local $objConnection = ObjCreate("ADODB.Connection") $objConnection.Provider = "ADsDSOObject" $objConnection.Open ("Active Directory Provider") $objCommand.ActiveConnection = $objConnection Local $strBase = "<LDAP://yourdomain.com/dc=yourdomain,dc=com>;(&(cn=*)(objectcategory=group));cn,distinguishedName;Subtree" $objCommand.CommandText = $strBase ;consolewrite($strbase & @cr) Local $objRecordSet = $objCommand.Execute If Not $objRecordSet.EOF Then ;$strName = $objRecordSet.Fields ("cn").Value $strCN = $objRecordSet.Fields ("cn").value ConsoleWrite($strCN & @CR) ;filewriteline($fichierencours,$strCN) $strdistinguishedName = $objRecordSet.Fields ("distinguishedName").value $utilisateur = $strdistinguishedName $objRecordSet.MoveNext EndIf $objConnection.Close EndFunc Edited October 9, 2006 by arcker -- Arck System _ Soon -- Ideas make everything "La critique est facile, l'art est difficile" Projects :[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013Â Get it Here [/list] Link to comment Share on other sites More sharing options...
MadBoy Posted October 9, 2006 Share Posted October 9, 2006 @Craig In this forum you can find few threads about AD. You can check JDEB posts about it or mine.You should find script to extract users or grps from AD there. My little company: Evotec (PL version: Evotec) Link to comment Share on other sites More sharing options...
skippynz Posted October 9, 2006 Author Share Posted October 9, 2006 (edited) @Craig In this forum you can find few threads about AD. You can check JDEB posts about it or mine.You should find script to extract users or grps from AD there. Hi MadBoy - i did do a search and found a couple of AD threads but since i dont know how to edit the COM side of things i was stumped. since then i found that VBS script above i have managed to convert it using someones converter in the scripts and scraps. so my script is working ok - however i do have an issue with one section perhaps you can help me with the script below is the full thing - toward the bottom where the ;------------------------ lines are i need to error check - ie if the group is empty and you try to export it that line throws up an error any ideas on how to check if empty then show a message saying its empty and then exit. ?? cheers Craig expandcollapse popup#include <GuiConstants.au3> #include <GuiList.au3> #include <File.au3> dim $Selected if not FileExists("ADGroups.ini") Then FileInstall("ADGroups.ini","ADGroups.ini") sleep(500) Run("notepad.exe " & @ScriptDir & "\ADGroups.ini") sleep(500) Msgbox(48,"First Time...", "This appears to be the first time you have run this AD Exporter - if you are in NZ you dont need to do anything other then close the opened file and this message. However if you are in another country you need to edit the file 'ADGROUPS.INI' which should now be open in Notepad. When you have modified 'ADGROUPS.INI' please save your changes and close the file then press OK to this message.") WinWaitClose("ADGroups.ini - Notepad") EndIf ; Setup the Gui and Label GuiCreate("Active Directory Exporter", 400, 305,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $QUESTION = GuiCtrlCreateLabel('Please press the button that corresponds to the OU that you would like to export the data from.', 12, 5, 390,30 ) $LIST = GUICtrlCreateList ( "Please select an OU...", 205, 40 , 190 , 230) ; Read in the OU Names and Button Names from ADGroups.ini $BUTTON_01 = IniReadSection ( "ADGroups.ini", "BUTTON01" ) $BUTTON_02 = IniReadSection ( "ADGroups.ini", "BUTTON02" ) $BUTTON_03 = IniReadSection ( "ADGroups.ini", "BUTTON03" ) $BUTTON_04 = IniReadSection ( "ADGroups.ini", "BUTTON04" ) $BUTTON_05 = IniReadSection ( "ADGroups.ini", "BUTTON05" ) $BUTTON_06 = IniReadSection ( "ADGroups.ini", "BUTTON06" ) $BUTTON_07 = IniReadSection ( "ADGroups.ini", "BUTTON07" ) $BUTTON_08 = IniReadSection ( "ADGroups.ini", "BUTTON08" ) $BUTTON_09 = IniReadSection ( "ADGroups.ini", "BUTTON09" ) $BUTTON_10 = IniReadSection ( "ADGroups.ini", "BUTTON10" ) #region --- Create the Buttons ; Create the Buttons $BUTTON_01_OU_NAME = $BUTTON_01[1][1] $BUTTON_01_BUTTON_NAME = $BUTTON_01[2][1] if $BUTTON_01_OU_NAME <> "" Then $BUTTON01 = GuiCtrlCreateButton($BUTTON_01_BUTTON_NAME, 5, 40, 190, 20) Else $BUTTON01 = "off" EndIf $BUTTON_02_OU_NAME = $BUTTON_02[1][1] $BUTTON_02_BUTTON_NAME = $BUTTON_02[2][1] if $BUTTON_02_OU_NAME <> "" Then $BUTTON02 = GuiCtrlCreateButton($BUTTON_02_BUTTON_NAME, 5, 60, 190, 20) Else $BUTTON02 = "off" EndIf $BUTTON_03_OU_NAME = $BUTTON_03[1][1] $BUTTON_03_BUTTON_NAME = $BUTTON_03[2][1] if $BUTTON_03_OU_NAME <> "" Then $BUTTON03 = GuiCtrlCreateButton($BUTTON_03_BUTTON_NAME, 5, 80, 190, 20) Else $BUTTON03 = "off" EndIf $BUTTON_04_OU_NAME = $BUTTON_04[1][1] $BUTTON_04_BUTTON_NAME = $BUTTON_04[2][1] if $BUTTON_04_OU_NAME <> "" Then $BUTTON04 = GuiCtrlCreateButton($BUTTON_04_BUTTON_NAME, 5, 100, 190, 20) Else $BUTTON05 = "off" EndIf $BUTTON_05_OU_NAME = $BUTTON_05[1][1] $BUTTON_05_BUTTON_NAME = $BUTTON_05[2][1] if $BUTTON_05_OU_NAME <> "" Then $BUTTON05 = GuiCtrlCreateButton($BUTTON_05_BUTTON_NAME, 5, 120, 190, 20) Else $BUTTON05 = "off" EndIf $BUTTON_06_OU_NAME = $BUTTON_06[1][1] $BUTTON_06_BUTTON_NAME = $BUTTON_06[2][1] if $BUTTON_06_OU_NAME <> "" Then $BUTTON06 = GuiCtrlCreateButton($BUTTON_06_BUTTON_NAME, 5, 140, 190, 20) Else $BUTTON06 = "" EndIf $BUTTON_07_OU_NAME = $BUTTON_07[1][1] $BUTTON_07_BUTTON_NAME = $BUTTON_07[2][1] if $BUTTON_07_OU_NAME <> "" Then $BUTTON07 = GuiCtrlCreateButton($BUTTON_07_BUTTON_NAME, 5, 160, 190, 20) Else $BUTTON07 = "off" EndIf $BUTTON_08_OU_NAME = $BUTTON_08[1][1] $BUTTON_08_BUTTON_NAME = $BUTTON_08[2][1] if $BUTTON_08_OU_NAME <> "" Then $BUTTON08 = GuiCtrlCreateButton($BUTTON_08_BUTTON_NAME, 5, 180, 190, 20) Else $BUTTON08 = "off" EndIf $BUTTON_09_OU_NAME = $BUTTON_09[1][1] $BUTTON_09_BUTTON_NAME = $BUTTON_09[2][1] if $BUTTON_09_OU_NAME <> "" Then $BUTTON09 = GuiCtrlCreateButton($BUTTON_09_BUTTON_NAME, 5, 200, 190, 20) Else $BUTTON09 = "off" EndIf $BUTTON_10_OU_NAME = $BUTTON_10[1][1] $BUTTON_10_BUTTON_NAME = $BUTTON_10[2][1] if $BUTTON_10_OU_NAME <> "" Then $BUTTON10 = GuiCtrlCreateButton($BUTTON_10_BUTTON_NAME, 5, 220, 190, 20) Else $BUTTON10 = "off" EndIf ; Create the Save / Save and Open Radio Buttons $SAVE1 = GuiCtrlCreateRadio("Save", 10, 260, 100, 20) $OPEN1 = GuiCtrlCreateRadio("Save and Open", 10 ,280, 100, 20) ; Setting the Save Option to be Default GUICtrlSetState ( $SAVE1, $GUI_CHECKED ) GUICtrlSetState ( $OPEN1, $GUI_UNCHECKED ) $EXPORT = GuiCtrlCreateButton("Export Data", 225, 275, 150, 20) #endregion --- ; Run the Gui GuiSetState() While 1 $msg = GuiGetMsg() Select ; If X is pressed Close the Gui and Exit the Script Case $msg = $GUI_EVENT_CLOSE ExitLoop ; Set the defaults for Auckland OU and check what save option has been set Case $msg == $BUTTON01 $OU = $BUTTON_01_OU_NAME $BUTTON = $BUTTON_01_BUTTON_NAME FileDelete($BUTTON & ".txt") $SAVE = GUICtrlRead ( $SAVE1 ) $OPEN = GUICtrlRead ( $OPEN1 ) _GUICtrlListClear($LIST) Groups() CreateListEntry() FileDelete($BUTTON & ".txt") Case $msg == $BUTTON02 $OU = $BUTTON_02_OU_NAME $BUTTON = $BUTTON_02_BUTTON_NAME FileDelete($BUTTON & ".txt") $SAVE = GUICtrlRead ( $SAVE1 ) $OPEN = GUICtrlRead ( $OPEN1 ) _GUICtrlListClear($LIST) Groups() CreateListEntry() FileDelete($BUTTON & ".txt") Case $msg == $BUTTON03 $OU = $BUTTON_03_OU_NAME $BUTTON = $BUTTON_03_BUTTON_NAME FileDelete($BUTTON & ".txt") $SAVE = GUICtrlRead ( $SAVE1 ) $OPEN = GUICtrlRead ( $OPEN1 ) _GUICtrlListClear($LIST) Groups() CreateListEntry() FileDelete($BUTTON & ".txt") Case $msg == $BUTTON04 $OU = $BUTTON_04_OU_NAME $BUTTON = $BUTTON_04_BUTTON_NAME FileDelete($BUTTON & ".txt") $SAVE = GUICtrlRead ( $SAVE1 ) $OPEN = GUICtrlRead ( $OPEN1 ) _GUICtrlListClear($LIST) Groups() CreateListEntry() FileDelete($BUTTON & ".txt") Case $msg == $BUTTON05 $OU = $BUTTON_05_OU_NAME $BUTTON = $BUTTON_05_BUTTON_NAME FileDelete($BUTTON & ".txt") $SAVE = GUICtrlRead ( $SAVE1 ) $OPEN = GUICtrlRead ( $OPEN1 ) _GUICtrlListClear($LIST) Groups() CreateListEntry() FileDelete($BUTTON & ".txt") Case $msg == $BUTTON06 $OU = $BUTTON_06_OU_NAME $BUTTON = $BUTTON_06_BUTTON_NAME FileDelete($BUTTON & ".txt") $SAVE = GUICtrlRead ( $SAVE1 ) $OPEN = GUICtrlRead ( $OPEN1 ) _GUICtrlListClear($LIST) Groups() CreateListEntry() FileDelete($BUTTON & ".txt") Case $msg == $BUTTON07 $OU = $BUTTON_07_OU_NAME $BUTTON = $BUTTON_07_BUTTON_NAME FileDelete($BUTTON & ".txt") $SAVE = GUICtrlRead ( $SAVE1 ) $OPEN = GUICtrlRead ( $OPEN1 ) _GUICtrlListClear($LIST) Groups() CreateListEntry() FileDelete($BUTTON & ".txt") Case $msg == $BUTTON08 $OU = $BUTTON_08_OU_NAME $BUTTON = $BUTTON_08_BUTTON_NAME FileDelete($BUTTON & ".txt") $SAVE = GUICtrlRead ( $SAVE1 ) $OPEN = GUICtrlRead ( $OPEN1 ) _GUICtrlListClear($LIST) Groups() CreateListEntry() FileDelete($BUTTON & ".txt") Case $msg == $BUTTON09 $OU = $BUTTON_09_OU_NAME $BUTTON = $BUTTON_09_BUTTON_NAME FileDelete($BUTTON & ".txt") $SAVE = GUICtrlRead ( $SAVE1 ) $OPEN = GUICtrlRead ( $OPEN1 ) _GUICtrlListClear($LIST) Groups() CreateListEntry() FileDelete($BUTTON & ".txt") Case $msg == $BUTTON10 $OU = $BUTTON_10_OU_NAME $BUTTON = $BUTTON_10_BUTTON_NAME FileDelete($BUTTON & ".txt") $SAVE = GUICtrlRead ( $SAVE1 ) $OPEN = GUICtrlRead ( $OPEN1 ) _GUICtrlListClear($LIST) Groups() CreateListEntry() FileDelete($BUTTON & ".txt") Case $msg == $EXPORT $Selected = GUICtrlRead ( $LIST , 1 ) if $Selected = "" or $Selected = "Please select an OU..." then MsgBox(0,"Nothing Selected.", "You did not select a valid group - closing now.",10) Exit EndIf ExportData($Selected) exit EndSelect WEnd Exit Func Groups() ; Bind to Active Directory; $objRootDSE = ObjGet("LDAP://RootDSE") $strDNSDomain = $objRootDSE.Get("DefaultNamingContext") ; Get group names for the specified OU $objGroup = ObjGet ("LDAP://"& $OU & $strDNSDomain ) ; Calling the export EnumerateGroups($objGroup) EndFunc Func EnumerateGroups($oCont) Dim $ogroup For $ogroup In $oCont Select Case StringLower($ogroup.Class)="group" If $ogroup.distinguishedName <> "" Then FileWriteLine($BUTTON & ".txt", $ogroup.Name) EndIf Case StringLower($ogroup.Class)="organizationalunit" and "container" EnumerateGroups ($ogroup) EndSelect Next EndFunc Func CreateListEntry() $file = FileOpen($BUTTON & ".txt", 0) $filelines = _FileCountLines($BUTTON & ".txt" ) For $x = 1 To $filelines Step 1 $line1 = FileReadLine($file,$x) $line = StringTrimLeft($line1,3) If @error = -1 Then ExitLoop if not $line = "" then _GUICtrlListInsertItem($LIST, $line) EndIf Next FileClose($file) EndFunc Func ExportData($GROUP_NAME) GuiSetState(@SW_HIDE) ; Bind to Active Directory; $objRootDSE = ObjGet("LDAP://RootDSE") $strDNSDomain = $objRootDSE.Get("DefaultNamingContext") ; Get Usernames from the group specified in the gui - ATRAPA / NZ domain $strContainer = "cn=" & $GROUP_NAME & "," & $OU $objGroup = ObjGet ("LDAP://"& $strContainer & $strDNSDomain ) $objGroup.getInfo() ; Read in the Usernames from the group $adminlist = "" ;--------------------------------------------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------------------------------------------- $arrMemberOf = $objGroup.GetEx("member") ;~ if @error = -1 then ;~ MsgBox(48,"Empty Group...","This group is empty therefore no file will be created.") ;~ Exit ;~ EndIf ;--------------------------------------------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------------------------------------------- For $strMember in $arrMemberOf $user = ObjGet ("LDAP://"&$strMember) if isobj($user) Then $adminlist &= $user.sAMAccountName & @crlf Next ; Select the folder where you want to save the exported data to - Default is the users Desktop if FileExists( $GROUP_NAME & ".txt" ) Then FileRecycle( $GROUP_NAME & ".txt") EndIf FileWriteLine( $GROUP_NAME & ".txt", $adminlist) ; If the Save and Open option was choosen open the saved file with Notepad. If $OPEN = 1 and $SAVE = 4 Then Run( 'notepad.exe "' & $GROUP_NAME & '.txt"' ) EndIf Exit EndFunc Edited December 4, 2007 by craig.gill 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