Jump to content

Problem With RegWrite


Carbon
 Share

Recommended Posts

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

 

 

Link to comment
Share on other sites

  • Developers

You are also missing the Type you are trying to write. Check the helpfile for the proper syntax.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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.

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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.

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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