Sign in to follow this  
Followers 0
Carbon

Problem With RegWrite

15 posts in this topic

I am attempting to modify a registry value in a Java install script which installs Java silently and also modifies the registry.

The registry change disables the update feature in Java.

Orig:

[HKEY_LOCAL_MACHINESOFTWAREJavaSoftJava UpdatePolicy]
"EnableJavaUpdate"=dword:00000001

Modified

[HKEY_LOCAL_MACHINESOFTWAREJavaSoftJava UpdatePolicy]
"EnableJavaUpdate"=dword:00000000

When I run the following line I get a return of zero and the registry is not modified:

RegWrite ("HKEY_LOCAL_MACHINESOFTWAREJavaSoftJava UpdatePolicy", "EnableJavaUpdate", 00000000)

Can anyone help?

Any suggestions would be very much appreciated.

Thanks,

Carbon

 

 

Share this post


Link to post
Share on other sites



I am currently running Win7 32 bit and the x86 version of autoit3.

Share this post


Link to post
Share on other sites

I've tried that and I am still getting the same result.

Share this post


Link to post
Share on other sites

Even when I add "REG_DWORD" to the line as the type I get the same result. I really should have put everything I tried in the first post as I am going to run out of posts for the day soon.  :sweating:

I've been scouring the forums for a good part of the day attempting different things and no matter what I try I just can't get it to modify the registry.

I really appreciate you taking the time to help me.

Share this post


Link to post
Share on other sites

Post what you have now and I will have a test with it.

You should be in the normal members now so the 5 posts limit is lifted. ;)

Jos

1 person likes this

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

You know what, this is really weird, I rebooted and it seems to be working fine now. I wonder why a reboot would have mattered at all. The script works either way now with both 00000000 & 00000001 in that line.

Share this post


Link to post
Share on other sites

I've been messing with this all day and all I needed was a reboot. Come on. :geek:

Share this post


Link to post
Share on other sites

Here is the script:

I know it's basic, please don't laugh.

#requireadmin
;EnvSet gets rid of Security Warning Popup
EnvSet ("SEE_MASK_NOZONECHECKS","1")
ShellExecute ( "\\svritsnas3\BARRACUDA\java\Java 7.7 Silent Install" )
EnvSet ("SEE_MASK_NOZONECHECKS","0")
;Checks whether to apply 64bit or 32bit Java Update Kill reg fix
$WinVer_Check = MsgBox (4, "Java Installer", "Is this a Windows 7 32-bit Machine?")
If $WinVer_Check == 6 Then
   RegWrite ("HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Update\Policy", "EnableJavaUpdate", "REG_DWORD", 00000000)
ElseIf $WinVer_Check == 7 Then
   RegWrite ("HKEY_LOCAL_MACHINE64\SOFTWARE\Wow6432Node\JavaSoft\Java Update\Policy", "EnableJavaUpdate", "REG_DWORD", 00000000)
EndIf

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

The last regwrite is wrong, but the first one should work.

Try this code and post the result in case you still have issues:

#requireadmin
If @OSArch = "X86" Then
   $rc = RegWrite ("HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Update\Policy", "EnableJavaUpdate", "REG_DWORD", 00000000)
   ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $rc = ' & $rc & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
ElseIf @OSArch = "X64" Then
   $rc = RegWrite ("HKEY_LOCAL_MACHINE64\SOFTWARE\JavaSoft\Java Update\Policy", "EnableJavaUpdate", "REG_DWORD", 00000000)
   ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $rc = ' & $rc & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
Else
   ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : Other OSARCH????: ' & @OSArch & @CRLF) ;### Debug Console
EndIf
Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Worked perfectly on X86 and thank you for getting rid of that needless MsgBox. Can I use those ConsoleWrite lines to debug any script? Also, in order to send them to a MsgBox would I have to create another line to print the error varable to a message box? Oh and you said the last regwrite wouldn't work? Is that because of the 64 at the end of HKLM? I thought I read that right in the help file as the proper syntax.

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Worked perfectly on X86 and thank you for getting rid of that needless MsgBox. Can I use those ConsoleWrite lines to debug any script? Also, in order to send them to a MsgBox would I have to create another line to print the error varable to a message box? Oh and you said the last regwrite wouldn't work? Is that because of the 64 at the end of HKLM? I thought I read that right in the help file as the proper syntax.

The Consolewrite(s) are shown when you press F5 in SciTE. This way it is easy to debug without annoying MsgBoxes.

Your Last RegWrite had an error since you had both 64 at the end of the Hivename and Wow6432node in the key path:

RegWrite ("HKEY_LOCAL_MACHINE64SOFTWAREWow6432NodeJavaSoftJava UpdatePolicy", "EnableJavaUpdate", "REG_DWORD", 00000000)

Mine looks different. ;)

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Gotcha. Well I tested it on a Win7 32-bit & 64-bit machine and it seems to work flawlessly. Thanks so much for your help Jos!

Share this post


Link to post
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
Sign in to follow this  
Followers 0