bazagee Posted September 13, 2010 Share Posted September 13, 2010 Hi all, First the disclaimer: Extreme newbie to AutoIT and a bad (easily frustrated) coder all round. This is simple so please be kind... I'm trying to remove some old Reg keys from a bunch of workstations on our Domain. I plan to use Bosteck VENM console (which accepts AutoIT scripts) to roll this out to machines as required. VENM will run the scripts under the permissions I need. So I have my .reg file and want to execute it, answer the MS msgbox (default Yes button) to 'Are you sure'. Click ok to the 'Registry keys applied' msgbox. Execute the fixmapi.exe app from windows\system32 folder then set the workstation to reboot. It would be nice to have user interaction to cancel the reboot and leave them with a message box explaining what was done and why they should reboot at their earliest convenience. If not interaction after x seconds, force reboot. How far I've got: lol! I've got as far as running the ShellExecute to run my .reg file but I can't seem to get the ControlClick to work? The messagebox that comes up has focus. I've been reading the tut's and looking at the Youtube vids but I'm obiously missing something 'very' basic. Thanks for the non-flamed replies! Link to comment Share on other sites More sharing options...
HavikTech Posted September 13, 2010 Share Posted September 13, 2010 Hi Bazagee, Welcome to Forums! To Delete to registry keys use: RegDelete() You can use this script to convert reg files into au3: http://www.autoitscript.com/forum/index.php?showtopic=119397 to show Message boxes use: MsgBox() For executing any exe you can use: Run() or ShellExecute() for reading all about Press the F1 key in AutoIt Editor and there is a Complete Help file which contains detailed info about all functions and the rest... Link to comment Share on other sites More sharing options...
notsure Posted September 14, 2010 Share Posted September 14, 2010 Also try the helpfile, it helps you ALOT. I learned it only from reading the help and other code. Link to comment Share on other sites More sharing options...
bazagee Posted September 15, 2010 Author Share Posted September 15, 2010 Also try the helpfile, it helps you ALOT. I learned it only from reading the help and other code.Thanks guys - I was off yesterday so getting back into it today. Thanks for the replies. Without having yet looked at the links provided - is there a script that could enumerate the registry looking for a keywork varible string and deleting it? We are having trouble with multiple users on one machine with HK (current) user keys that reference a non existant server.Thanks again for the welcome and links. Link to comment Share on other sites More sharing options...
bazagee Posted September 15, 2010 Author Share Posted September 15, 2010 (edited) As an update I trying to get PsaltyDS' _RegSearch script to find all instances of a value in all keys and registry values but I can't seem to work out how to add my value to $sSearchVal in that script. Edited September 15, 2010 by bazagee Link to comment Share on other sites More sharing options...
Mat Posted September 15, 2010 Share Posted September 15, 2010 Use: "REGEDIT /S pathname" to silently import a file (e.g. no messages) AutoIt Project Listing Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 15, 2010 Share Posted September 15, 2010 (edited) With _RegSearch() you would use this to find them: $aResults = _RegSearch("HKCU\", "ServerNameToFind", 1, True) That will search HKCU, find only values that have "ServerNameToFind" in the data (because $iType = 1), and return an array for the results.You would then use a For/Next loop to go through the array and delete the values. This will take some minor string manipulation because the results will look like this in each array element: "HKCU\Key\SubKey\SubSubKey\ValueName = \\ServerNameToFind\share"You would extract just the key path and value name, then use them like this: RegDelete("HKCU\Key\SubKey\SubSubKey", "ValueName")Edit: Clarity. Edited September 15, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
bazagee Posted September 15, 2010 Author Share Posted September 15, 2010 Use: "REGEDIT /S pathname" to silently import a file (e.g. no messages) Thanks Mat - I'm so new to this I'm not sure how to incorporate your suggestion I figured out that I have to 'call' PsaltyDS's function so I started with this: _RegSearch("HKLM", "test", 1) Func _RegSearch($sStartKey, $sSearchVal, $iType = 0x07, $fArray = False) Local $v, $sVal, $k, $sKey, $sFound = "", $sFoundSub = "", $avFound[1] = [0] It runs of serveral seconds or more but doesn't return anything - Link to comment Share on other sites More sharing options...
Mat Posted September 15, 2010 Share Posted September 15, 2010 Run("REGEDIT /S test.reg") It won't help you in your searching but that's the easiest way to get a .reg file merged without messages and prompts. I'm not sure if you even need that now that you are using the search to delete, but ah well. Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
bazagee Posted September 15, 2010 Author Share Posted September 15, 2010 Thanks PsaltyDS, I'm going to take a look at AutoIT 1 2 3 and see if I can learn more about how to run this program. I'm just pressed for time to find a solution for our network. I didn't want to have to visit every machine, but the heats on so I had to dive in see if I could figure it out. Appreciate all the help so far for all posters. Link to comment Share on other sites More sharing options...
bazagee Posted September 15, 2010 Author Share Posted September 15, 2010 And AutoIT 1 2 3 won't run on my 64bit Win7 box..... 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