Jump to content

Newbie help running reg file answering msgboxes


bazagee
 Share

Recommended Posts

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

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

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

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 by bazagee
Link to comment
Share on other sites

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 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

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

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

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...