rbenner1184

Java Uninstall via msiexec

8 posts in this topic

Hello,

I am ready to rip my hair out at this point I am not knew to autoit or scripting at all and that is why I am failing to understand what I am doing wrong here. When i run the command in the command prompt the command executes successfully as it should, but when i attempt to run this code in autoit nothing seems to happen. I am really failing to realize why, becuase I use Runwait to run command line parameters all the time. Can some one please help me out here and show me why this will not work for me. The script is uninstalling java and obviously i need to have this for many different versions of java, but lets just get this one working first. Any ideas? thanks.

#RequireAdmin

$WinDir = "C:\Windows\System32"


RunWait($WinDir & "\taskkill /f /im java.exe /T")
RunWait($WinDir & "\taskkill /f /im javaw.exe /T")
RunWait($WinDir & "\taskkill /f /im javaws.exe /T")
RunWait($WinDir & "\taskkill /f /im jqs.exe /T")
RunWait($WinDir & "\taskkill /f /im jusched.exe /T")
RunWait($WinDir & "\taskkill /f /im iexplore.exe /T")
RunWait($WinDir & "\taskkill /f /im firefox.exe /T")


;REM Uninstall v1.4.2_19
RunWait($WinDir & "\MsiExec.exe /x {7148F0A8-6813-11D6-A77B-00B0D0142190} /qb /norestart")

Share this post


Link to post
Share on other sites



It doesn't seem to be lines 17 through 23. It seems the issue is with line 27 call msiexec.

  • RunWait($WinDir & "MsiExec.exe /x {7148F0A8-6813-11D6-A77B-00B0D0142190} /qb /norestart")

Share this post


Link to post
Share on other sites

It work with me:

; ↓  /x {7148F0A8-6813-11D6-A77B-00B0D0142190}
MsiExec.exe /X{ID} /qb /norestart

; ↓ {ID}
;~ HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall|{26A24AE4-039D-4CA4-87B4-2F83218025F0}|Java 8 Update 25|20150116
;~ HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall|{26A24AE4-039D-4CA4-87B4-2F86418025F0}|Java 8 Update 25 (64-bit)|20150118

Regards,
 

Share this post


Link to post
Share on other sites

I tried running the following and no dice still.

RunWait('"' & @SystemDir & "\MsiExec.exe /x {7148F0A8-6813-11D6-A77B-00B0D0142190} /qb /norestart"& '"')

Share this post


Link to post
Share on other sites

I tried running the following and no dice still.

RunWait('"' & @SystemDir & "\MsiExec.exe /x {7148F0A8-6813-11D6-A77B-00B0D0142190} /qb /norestart"& '"')

 

Syntax error -> false path!

 

Local $IT='"' & @SystemDir & '\MsiExec.exe" /X{26A24AE4-039D-4CA4-87B4-2F83218025F0} /qb /norestart'
ConsoleWrite($IT&@CRLF)
RunWait($IT)

Regards,
 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Ok i figured it out it seems that autoit did not like me using #RequireAdmin also when i copied and pasted the code into a new au3 it worked. Go figure. Thanks for all your help. Sorry actually I meant to say Trong you were right besides that the syntax was incorrect. Thanks!

Edited by rbenner1184

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

  • Similar Content

    • lewisg
      By lewisg
      Suddenly a RunWait command has stop working after 2 years of no errors, issues, or problems. The code uses RunWait to start Plink.exe, a command-line remote connection tool similar to UNIX ssh. I'm using it to ssh to a linux (Centos) machine, run a Perl script, and redirect the output to a file on a PC running the AutoIt script.  
       
      $FilePath = "C:\AutoIT\LED" $FilePathPlus = $FilePath & "\plink.exe" $Code1 = RunWait(@ComSpec & " /c " & $FilePathPlus & " -ssh -l root -pw ?????? 10.170.4.163 /usr/local/nagios/etc/led.pl > C:\AutoIT\LED\led.txt ", @SW_SHOW) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : @ComSpec & " /c " & $FilePathPlus & " -ssh -l root -pw ????? 10.170.4.163 /usr/local/nagios/etc/led.pl > C:\AutoIT\LED\led.txt " = ' & @ComSpec & " /c " & $FilePathPlus & " -ssh -l root -pw ?????? 10.170.4.163 /usr/local/nagios/etc/led.pl > C:\AutoIT\LED\led.txt " & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console The ConsoleWrite output when cut-n-pasted into a DOS box produces the expected file so I know it works. I've also tried many variations of the function moving, adding, and changing the " and ' (quote) marks. Also tried it without the @ComSpec macro and other related functions...e.g.  ShellExecuteWait , etc.
      The PC is a Windows 10 64bit and AutoIT is version 3.3.14.2.
      Searching here and Google has not yielded any clues that helped. 
    • goodmanjl531
      By goodmanjl531
      Hope someone can help as quotes within quotes is always confusing.  I am creating a silent install of printer software and want to call via runwait comspec line.
      The call within a cmd line is below
      samsung.exe /s /n"Samsung SL-M3220ND" /p"xxx"
      xxx will be stored as a variable  $PrinterIP which would be as example  10.10.10.20    I need to use a variable as i am doign this for a business and need it to be based on the store i install at that has a specific IP range.
       
      I started with the below as 2 possibilities but no luck..
      RunWait(@ComSpec & "/c " & "samsung.exe /s /n""Samsung SL-M3220ND"" /p""" & $PrinterIP ") RunWait(@ComSpec & "/c " & "samsung.exe /s /n'Samsung SL-M3220ND' /p'" & $PrinterIP '") but i cant get it to compile as i have errors on the line..  thanks in advance.
    • tremolux66
      By tremolux66
      Initial Problem
      I've written several scripts with the following sequence:
      Execute a program using Run w/stdout+stderr captured Typically processes all the files in one directory tree to populate a second tree Execute a second program (also with Run) to monitor the products of the first program and Display a progress bar (percentage of output files complete) Also monitor the first program's process and exit when it terminates The script then calls ProcessWaitClose (no timeout) on the first program's process and Checks the first program's results Kills the monitor program if it hasn't already exited on its own. Sometimes, ProcessWaitClose returns 1 with @error = 0 and @extended = 0xCCCCCCCC (actually, 0xFFFFFFFFCCCCCCCC), which seems ambiguous: the documentation says that @error = non-zero and @extended = 0xCC... means an invalid PID (unclear what the return value is), and 1 is returned for non-existent processes (but no mention of @extended). The 1/0/0xCC... result seems to occur when the first program exits very quickly (with or without an error). Since the exit value is not available, the script scans the program's output and tries to determine whether it ran successfully. This has gotten complicated and unreliable.
      Partial Fix
      I've now implemented a much simpler approach that works for most cases:
      Modify the monitor program so that it ignores the other program's process (the monitor always gets killed by the script anyway) Execute the monitor program first using Run, then execute the processing program with RunWait When RunWait returns, the child process exit value is available, so the script can ignore its output (which isn't available anyway) If the monitor program is still running, kill it. Remaining Issue
      However, there are still a couple of cases where it's necessary to get both the exit value from the processing program and its output. Since RunWait doesn't capture stdout and stderr for the parent script, it's looking like I'll have to call RunWait and redirect the 2 streams to a temp file and then scan it. Also, to do the redirect, I think I'll have to use @ComSpec to execute the processing program, which adds an undesired layer.
      Does anybody have a better (cleaner) way to handle these cases?
    • breakbadsp
      By breakbadsp
      I want to run a python script from autoit. 
      I know we can do this with shellexecute or run , but this python script takes 3 cmd line arguments.
      How to pass them from autoit script?
      I tried many ways.
      Following solution also not working 
      e.g. 
      RunWait( 'fullpath\Python.exe Scriptpath\ReadLog.py  -f "file.log" -k "key" -e "errMsg" ') Found solution:
      RunWait( 'fullpath\Python.exe ReadLog.py -f "file.log" -k "key" -e "errMsg" ', 'Working_directory_path')  
      PFB description:
      https://stackoverflow.com/questions/45757834/how-to-pass-command-line-arguments-to-a-python-script-anyscript-while-executin
       
    • StMaSi
      By StMaSi
      I'm attempting to code a Run or RunWait command that is a little on the long side and contains multiple sets of embedded quotes (as it would be issued from a CMD prompt), but can't for the life of me figure out the containing quotes as pertains to AutoIt. Here's the one-line command as it would be issued via a CMD prompt...
      "\\AppServ\G$\Connectivity\Clients\Citrix\Receiver\14.5.0.10018\CitrixReceiver.exe" ADDLOCAL="ReceiverInside,ICA_Client,WebHelper,SSON,AM,SELFSERVICE,USB,DesktopViewer,Flash,Vd3d" ALLOWADDSTORE=A ALLOWSAVEPWD=A ENABLEPRELAUNCH=Y ENABLE_SSON=Yes STORE0="AppStore;https://receiver.domain.net/Citrix/Apps/discovery;on;AppStore" /EnableCEIP=false /includeSSON /noreboot /silent I've tried so many different combinations of surrounding quotes with Run and RunWait, I just don't understand why it's this difficult to get past this.
      Can anyone assist with this?
      Thank you.