swing - Disable Windows Auto Update Using Java -
try { final string reg_add_cmd ="cmd /c reg add \"hkey_local_machine\\software\\"+ "microsoft\\windows\\currentversion\\windowsupdate"+ "\\auto update\" /v auoptions /t reg_dword /d 1 /f"; process objprocess; //objprocess cmd /c = runtime.getruntime().exec(new string[] //{"reg add \"", " hkey_local_machine\\software\\microsoft\\windows //\\currentversion\\windowsupdate\\auto update"," /v auoptions /t reg_dword /d 1 /f"}); objprocess = runtime.getruntime().exec(reg_add_cmd); system.out.println("reg_add_cmd:::"+reg_add_cmd); bufferedreader reader=new bufferedreader(new inputstreamreader(objprocess.getinputstream())); string line=reader.readline(); system.out.println("windows auto update::::"+line); final int exitstatus = objprocess.waitfor(); int exitval = objprocess.exitvalue(); system.out.println("exitstatus::::"+exitstatus); system.out.println("exitval::::"+exitval); //system.out.println("processed finished status: " + exitval); if(exitstatus != 0){ system.err.println("error while installing application!!"); } //objprocess = runtime.getruntime().exec("reg add "hkey_local_machine\software\"+ // "microsoft\windows\currentversion\windowsupdate\auto update" /v auoptions /t reg_dword /d 1 /f"); } catch (interruptedexception ex) { ex.printstacktrace(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } }
this code diable windows auto update in windows 7. once executed getting responce "the operation completed successfully" in console, not reflecting in control panel can 1 regarding this. thanks
i think on wrong way. indeed windows stores lot of configuration information in registry. not mean component stores information , reads on startup performs polling on registry value see whether else has changed value.
this happens in case. there component responsible on automatic updates. starts when system starts , reads configuration registry. change registry value component not know this.
to perform operation correctly should find api , call it. fortunately implemented command line utility task: http://www.intelliadmin.com/index.php/2012/10/manage-automatic-updates-from-the-command-line/
take on article. run utility java , work you. sure there other solutions similar. example take on wmi. if find wmi api can write jscript or vbscript , run java using cscript
interpreter.
Comments
Post a Comment