-
Posts
280 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Neutro
-
Newbie question: How to wait till the end of the script?
Neutro replied to User3D's topic in AutoIt General Help and Support
Hey and welcome to the forum I think the answer you are looking for is here: Short version: you should get correct %ERRORLEVEL% value if you run your autoit script from a .bat file and not from the CMD prompt. Cheers from Montpellier PS: when you post Autoit code in this forum, use: [.autoit] (without the ".") your code [./autoit] (without the ".") It shows your code like this: #requireadmin Local $Succes="Succès de la mise à jour de la base de données" Local $Derniere="Vous avez la dernière version" Local $Erreur="Une erreur" Local $mode=0 Local $prog="C:\Program Files (x86)\Malwarebytes\mbam.exe /update" Local $file = FileOpen("toto.txt", 2) ; Check if file opened for writing OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf MsgBox(0, "OK", "toto.txt opened") Local $pid=Run($prog, "", @SW_MAXIMIZE ) if $pid = 0 Then FileWriteLine($file, "Erreur lancement " & $prog & "\n") FileClose($file) Exit ($mode) EndIf FileWriteLine($file, "Lancement " & $prog & " pid=" & $pid & " \n") WinWaitActive("Malwarebytes Anti-Malware") Local $text = WinGetText("Malwarebytes Anti-Malware") FileWriteLine($file, "Texte de la fenetre = " & $text & "\n") if StringInStr($text, $Erreur) > 0 Then $mode=1 FileWriteLine($file, "Erreur mise a jour \n") ElseIf StringInStr($text, $Derniere) > 0 Then $mode=0 FileWriteLine($file, "La dernière version est dejà installée") ElseIf StringInStr($text,, $Succes) > 0 Then $mode=0 FileWriteLine($file, "mise à jour reussie \n") Else $mode=2 FileWriteLine($file, "Le logiciel doit etre mis a jour \n") EndIf ;fin test resultats update Send("{ENTER}") WinWaitNotActive("Malwarebytes Anti-Malware") $mode=ProcessWaitClose($pid) FileWriteLine($file, "Fin process " & $pid & " code retour = " & @extended & "\n") FileClose($file) Exit (@extended) -
How can i send a Command to "cmd"
Neutro replied to Starstar's topic in AutoIt General Help and Support
Hey, Is run("rasdial BSNL /disconnect") not working? -
Identify active network connection and change DNS server
Neutro replied to Neutro's topic in AutoIt General Help and Support
Damn this WMI stuff is amazing, thanks again guys I managed to do what I wanted like this: #requireadmin #include <Array.au3> $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $query = "" Local $active_netword_cards[1] Local $network_cards_to_setup[1] $active_netword_cards[0]="" $network_cards_to_setup[0]="" ;getting a list of all network cards $objWMIService = ObjGet("winmgmts:\\localhost\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems if $objItem.NetConnectionStatus == "2" OR $objItem.NetConnectionStatus == "9" Then ;if the network connection is active, we add the index of the network card and the connection name to $active_netword_cards array _arrayAdd($active_netword_cards, $objItem.Index) _arrayAdd($active_netword_cards, $objItem.NetConnectionID) endif Next Endif ;getting settings from all network cards in the array $active_netword_cards for $i = 1 to UBound($active_netword_cards) - 1 step 2 $query = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE Index = " & $active_netword_cards[$i], "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) For $objItem In $query if $objItem.DHCPEnabled == "False" Then _arrayAdd($network_cards_to_setup, $active_netword_cards[$i+1]) ;if DHCP is disabled, we add the network card name in the $network_cards_to_setup array next Next ;setting up primary DNS server of all network cards in the $network_cards_to_setup array ;DNS server used in this example is 10.10.2.45 for $i = 1 to UBound($network_cards_to_setup) - 1 step 1 Runwait('netsh interface IP ADD DNS "'& $network_cards_to_setup[$i] &'" 10.10.2.45 index=1') Next -
Identify active network connection and change DNS server
Neutro replied to Neutro's topic in AutoIt General Help and Support
Thanks for your answers @JLogan3o13 > Since I didn't find a way to identify the name of the active network cards I didn't try anything yet ^^ @guinness > I saw before posting that netsh can indeed be used to setup a dns server on a network connection, but you first need to know the connection name to use it! Thanks for the advice on the WMI stuff, i'll look into it -
Hey guys, I need to run a script on several computers that can identify the active network connection, then for each one of them: - if the network connection is not using DHCP (fixed IP address), change the current DNS server to another one - if the network connection is using DHCP, do nothing. I don't know the names of the network connections on the different computers, so the script has to find this by itself. I've been searching about this but I'm having troubles finding a working solutions. Any help would be greatly appreciated! TIA
-
Hey, I had some troubles finding this so i'm sharing it here hoping it will help some other people! Export Windows network settings for all network adapters: ShellExecuteWait("regedit.exe","/e network.reg HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters\Interfaces","C:\NetworkSettings\") This will create a file "network.reg" in the folder "C:NetworkSettings" Import Windows network settings for all network adapters using previously exported file: Run("Regedit /S C:\NetworkSettings\network.reg") If the computer is running under a 64bit OS, you need to use this line before importing or it will fail: DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1) This is really useful when you have a computer with a fixed IP that needs to go to DHCP then go back to fixed IP. Just export before DHCP, then import when going back to fixed IP Tested sucessfully on Windows XP and Windows 7.
-
Hey guys, I needed something to clean users profiles directories on the computers at my work which are running Windows XP and Windows 7, so I've written this little script below. It removes : - Users Windows temporary files - Users WIndows temporary Internet Explorer files - Users Firefox temporary Internet files - Users Chrome temporary Internet files of all users directories on a computer running Windows XP or Windows 7. For removing maximum temporary files, it is better to create a brand new session just to run this tool on it, so windows won't lock temporary files on the sessions that need to be cleaned. For compiling this script you need to put the file "RecFileListToArray.au3" into your AutoIT3 "Include" folder. You can download it here: RFLTA.zip. Original release by Melba23 thanks a lot to him for this! Enjoy #Edit 04-16-13: added v2 of the script which fixes an error that sometimes happend when trying to find users profile directory and optimize file deletion. #Edit 04-17-13: added v2.1 that sucessfully delete hidden folders (parameter error in the function _Recfilelisttoarray, was set to 14 instead of 2, omitting hidden folders). #Edit 04-21-13: added v2.2 which shows the current file beeing deleted. clean windows profiles v2.2.au3
-
Hey, Can you acces your pocket PC files using windows explorer with a path like "My Pocket PCfoldersubfolder" when activesync is active? If the answer is yes, then it's easy. Locate a file that always exists on your pocket PC, like a system file or something. Let's say the file path is "My pocket PCWindowsutility.dll" Use: $temp = FileExists("My pocket PC\Windows\utility.dll") If the file is found, $temp = 1. So if activesync is on, $temp = 1 If the file is not found, $temp = 0. So if activesync is off, $temp = 0
-
Hey guys, I'm trying to find a way to easily get a windows folder permissions informations, in other words, a list of the permissions (read, write, list,...) that every user or group have on this folder. I've been looking to but I can't figure out how can I use it or if it can do it Any help would be greatly appreciated. TIA
-
Thank you very much for this function, it's fast and so easy to use!
- 39 replies
-
- _regenumkeyex
- _filelisttoarrayex
-
(and 4 more)
Tagged with:
-
I wrote 4 scripts that do the following: - Get_AD_Groups_Excel.au3: creates an excel file containing all groups of an AD in different columns, each column containing all users that belong to these groups. The goal of this script is to easily see if there are some "unwanted" users in the different groups of your AD. - Get_AD_Groups_Textfile.au3: same than above but with a textfile output, 1 line per group, users separated by a coma ",". The goal of this script is to export these informations into another software easily. These 2 scripts require the file "sid.txt" to convert windows special accounts SID to readable english account names (this is an extract from microsoft website). - Get_AD_Users_Excel.au3: creates an excel file containing all users of an AD in different columns, each column containing all groups that belong to these users. The goal of this script is to easily see if there are some "unwanted" groups that a user is a member of. - Get_Ad_Users_Textile.au3: same than above with textfile output for exporting these informations to another software. You need to run these scripts on a Windows domain administrator session to get it working, or modifify the AD_Connect() lines to include domain administrator login/password. Special thank to water for helping me getting this done Get AD groups and users informations.zip
-
Active Directory UDF - Help & Support (II)
Neutro replied to water's topic in AutoIt General Help and Support
This is exactly what I needed water, thank you very much once again When i'll be done i'll post my script on your "Example scripts" topic -
Active Directory UDF - Help & Support (II)
Neutro replied to water's topic in AutoIt General Help and Support
Well I didn't know about this ldap thing, and tbh i don't know much about ldap Thanks for enlighting me Yeah I thought about this too but I liked the idea of having all organised datas in one array if I wanted to do something else later. But yeah you're right, this is much easier so i'll stick to this right now and will have fun with arrays later Only thing I'm missing is a way to get users descriptions as well (we use this as full name of people in my company). Thanks again for your help, i really appreciate it. -
Active Directory UDF - Help & Support (II)
Neutro replied to water's topic in AutoIt General Help and Support
What i want to achieve is getting this in an excel document for every group in our AD: http://img187.imagevenue.com/img.php?image=350326768_example1_122_362lo.jpg for example, filled with fake values: http://img296.imagevenue.com/img.php?image=350328958_example2_122_201lo.jpg So to answer your questions, I thought that a 4D array was the easiest way to acces informations, using 1st dimension as group names, 2nd dimension as group description, 3rd as user names and 4th as user names descriptions. Then create one column for every group name in the first dimension, fill it with user names of 3rd dimension, and a second column with the group description in second dimension filled with user names descriptions in 4th dimension. But maybe you have a better idea? There should be no groups in groups in my company. But if that happens, I was expecting that _AD_GetObjectsInOU("", "(&(objectclass=group)(description=*))", 2, "sAMAccountName,description") would include even the groups in groups, so even if group A includes group J for example, they would be both listed in the array, and so I would have a column for each of them. Column for group A would be filled with : user1,user2,...., group J name, other users... and then column for group J would be filled with : user1, user2, ... -
Active Directory UDF - Help & Support (II)
Neutro replied to water's topic in AutoIt General Help and Support
yes, i managed to gather all the groups of my AD and their description in a 2 dimensional array using: $groupsarray = _AD_GetObjectsInOU("", "(&(objectclass=group)(description=*))", 2, "sAMAccountName,description") Then if I use: $usersarray=_AD_GetGroupMembers($groupsarray[1][0]) I get the users of the first group of my AD in another array. But I'm having two problems at this point: 1°) I don't understand how can I put the array $userarray into the first array $groupsarray as a new dimension 2°) I don't understand how can I get the description related to the usernames that are inside $userarray I'll keep digging ^^ -
Active Directory UDF - Help & Support (II)
Neutro replied to water's topic in AutoIt General Help and Support
Hey, I'm trying to get a 4 dimensionnal array containing: - in the first dimension, the name of the different groups of my AD - in the second, the description of the groups that are in the first dimension, - in the third, the users that are in the groups of the first dimension - in the fourth, the description of the users of the third dimension. In other words, i'd like to have $array[groupname][groupdescription][username][userdescription] for every group and every user of my AD. I'm looking at the examples that I found to try to understand how to do that but I'm having a hard time, if anyone could give me a hint it would be much appreciated TIA -
Hey water, Just want to say thank you very much for your amazing work, you saved me a lot of time at work
-
How do u link programs.... Simolokid + Zero57
Neutro replied to zero57's topic in AutoIt General Help and Support
dim $sometext $sometext = "Script Start!" While 1 = 1 $sometext = InputBox($sometext, "InputBoxDescription", "DefaultInputText") Wend Each time you press OK it will put the text you wrote as the next inputbox name. Is this what you wanted?