Jump to content

Bearpocalypse

Active Members
  • Posts

    46
  • Joined

  • Last visited

Recent Profile Visitors

56 profile views

Bearpocalypse's Achievements

  1. Thanks @FrancescoDiMuro and @JLogan3o13 . That gives me exactly what I need. I can now build off that and do more witchcraft that I used to be able to do.
  2. Longtime no see everyone! I haven't had a chance to do some coding in a while since some management has decided that innovation was just awful since they didn't understand it. It's been a couple of years since I've actually produced anything. I have now taken a new position within the same company with a new manager who salivates at innovation. My new role involves doing a lot of account management, like a Sys Admin but I'm not a Sys Admin. Anyways, I'm throwing together a script to pull a users group memberships and users who are members of a certain group. Both requests seem to come often. We don't have a quick pull up and export tool, so I'm making one. I'm using AD.au3 to get the members and populate into a listbox. I think I've gone full potato because I cannot for the life of me figure out how to remove the OU information from the strings. Example, I have a list of stuff that looks like this: Group-Thing,OU=Place1,OU=Place2,OU=Place3 I'm wanting to remove everything past the first comma. I used a simple StringTrimLeft to remove the CN= from the string. By just pulling straight from AD like this am I doing it wrong or is there a different way to pull Group-Thing by itself? Here is my very very early code, like this is what I tossed together in about 10 mins, design time from Koda included. Forgive me for being rather rusty. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <AD.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Group Soup", 483, 403) $Input1 = GUICtrlCreateInput("", 32, 64, 169, 21) $Group1 = GUICtrlCreateGroup("User Group Lookup", 16, 40, 201, 73) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Group Member Lookup", 16, 160, 201, 73) $Input2 = GUICtrlCreateInput("", 32, 192, 169, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) $List1 = GUICtrlCreateList("", 240, 40, 225, 331) $Button1 = GUICtrlCreateButton("User Group", 16, 120, 91, 25) $Button2 = GUICtrlCreateButton("Group Members", 16, 240, 91, 25) $Button3 = GUICtrlCreateButton("Export", 128, 120, 91, 25) $Button4 = GUICtrlCreateButton("Export", 128, 240, 91, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _List_User_Groups(GUICtrlRead($Input1)) EndSwitch WEnd Func _List_User_Groups($User) ; Open Connection to the Active Directory _AD_Open() If @error Then Exit MsgBox(16, "Active Directory Example Skript", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended) ; Get a sorted array of group names (FQDN) that the user is immediately a member of Global $aUser = _AD_GetUserGroups($User) If @error > 0 Then MsgBox(64, "Active Directory Functions - Example 1", "User '" & $User & "' has not been assigned to any group") Else For $i = 1 To UBound($aUser) - 1 GUICtrlSetData($List1, StringTrimLeft($aUser[$i], 3)) Next EndIf ; Close Connection to the Active Directory _AD_Close() EndFunc
  3. Ok thanks. I've had a few rough weeks and haven't really looked into the forums. Apologies for not reading in advance.
  4. I have a script that helps manage our RMA\warranty items that has been working for a while now without issues. I have recently updated my work PC with a new model that runs Windows 7 64bit rather than 32bit. I'm also running AutoIt ver. 3.3.14.2. I am unsure of the version of my old PC since I had to reuse it for an emergency replacement for our ER. I have reproduced the error on another PC running Windows 7 32bit as well as having another tech reproduce the error on yet another PC. When I try to make a new entry or modify an existing entry, I am able to get Excel to load properly. I think my issue is when I do the search for a device serial. The crash error is: "C:\Program Files (x86)\AutoIt3\Include\Excel.au3" (656) : ==> The requested action with this object has failed.: $aResult[$iIndex][1] = $oMatch.Name.Name $aResult[$iIndex][1] = $oMatch^ ERROR I added an object error handler and got the following error: Error Number: 80020009 WinDescription: Exception occurred. Script Line: 656 I have a similar script for something else that works without issues. I have attached the script and associated files that go along with everything. There is a Users.ini file in the \Files\Data folder that has all the information you need to enter to allow you to use the script. The code will probably look very sloppy to you but it works for me since I'm not pro. I've also thought about rewriting a lot of it using more of what I am learning. Thanks for any help that I can get. Please be gentle with me. Coin Purse.zip
  5. You can always show all files. Using the +H attribute will make it as if you right-clicked and went to Properties and hit the Hidden checkbox. +SH will be like a super hide. You can show system files, but if you uncheck the Hide protected operation system files option in Folder Options the files will show. BUT, a person will get a super scary Windows message telling them it is not a good idea to show OS files. 9.9/10 someone will leave them hidden. There is no 100% hide ability.
  6. FileSetAttrib("FILE GOES HERE", "+H") ;Hides the file or folder. FileSetAttrib("FILE GOES HERE", "+SH") ;Gives the file or folder system attribute and hides it even if the normal unhide option is checked under folder options.
  7. You can feel free to start your own and then post your code if you need assistance.
  8. Oh how I don't miss that when I was working on my thing.
  9. I think I might have something that can help. I have a script that runs a spreadsheet in the background and when it's done it gets saved. I had to check for the object to make it work. ;Setting up the workbook $oExcel = ObjCreate("Excel.Application") $oBook = $oExcel.Workbooks.Open(@ScriptDir & "\..\Spreadsheet.xlsx") $oExcel.Visible = False ;Invisible Excel! ;Stuff ;Here is where I checked for the object before saving and closing. If IsObj($oExcel) Then _Excel_BookSave($oBook) If @error Then MsgBox(64, "", "Unable to save spreadsheet.") If IsObj($oExcel) Then _Excel_Close($oExcel, True, True) If @error Then MsgBox(64, "", "Unable to close spreadsheet.") Let the fun begin!
  10. You can try and run each uninstaller on your PC and see what process is being used. I've had to do that many times. When you can do a While ProcessExists("ProcessNameHere.exe") Sleep(100) Wend I've even gone as far as doing a While WinActive loop because of MSIEXEC wanting to hang on me. Maybe this might help.
  11. This....is....AMAZING and fun. I might have to borrow this and use if during December,
  12. See! All it took was me asking on here. I figured out my problem. The string was still an array so I had to do an _ArrayToString to fix my problem.
  13. I have a listbox that is populating some values. Some of the values are coming up from the array that I'm reading as VALUE1 / VALUE2. I'm assuming I can do a Read and MouseGetPos and copy each individual value. GUICtrlRead($$Listbox, MouseGetPos(0) & ", " & MouseGetPos(1)) If I click on VALUE1, I should be able to copy that data and the same for VALUE2. I've been working with StringSplit and am not getting too far. Anyone able to toss some advice? I'm sure it's easy and I'll end up figuring it out now that I've asking on here.
  14. I've had issues with ControlSend. Try using ControlCommand.
×
×
  • Create New...