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

    • 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.
    • WannaBeGut
      By WannaBeGut
      Hello,
      I just wrote a script that should copy data into my cloud using xcopy (cmd), but I want the Status Bar I have in my GUI to change it's text like that:
      working. -> working.. -> working... -> working. ...
      I would also like to make a button which interrupts xcopy (simply closing it should do the trick), but I don't know how to call ProcessClose("xcopy.exe") using a button, while I'am waiting for RunWait to finish.
      Example:
      $command = 'xcopy "' & @DesktopDir & '\text.txt"' & ' "\\ADMIN-CLOUD\private\" /EECHIY' $SW_STATE = @SW_HIDE RunWait(@ComSpec & " /c " & '"' & $command & '"', @DesktopDir, $SW_State) Please tell me if you need any further information! 
    • ur
      By ur
      I have written a script to build the Installshield project file(.ism) to setup files(.msi or .exe based on the release settings..).
      So when the user runs the script the process will be automatic for multiple ism files.
      Func Build($sOutputIsm,$ReleaseName,$sFilePath="None",$NewName="None") ;build the ism to get the msi If not FileExists($sOutputIsm) Then Logging("File Not Found: $sOutputIsm$",4) MsgBox($MB_OK + $MB_ICONERROR, "Error", "Could not find file ""$sOutputIsm$"".") Return EndIf Logging("Started Building $sOutputIsm$",4) ShowTrayTip($AppName, "Started Building $sOutputIsm$", 10, $TIP_ICONASTERISK) Dim $sBuildExe,$sBuildCommand,$Ret $sBuildExe = FindFileInPath("ISCmdBld.exe", "%ProgramFiles(x86)%\InstallShield") $sBuildCommand = """$sBuildExe$"" -p ""$sOutputIsm$"" -r ""$ReleaseName$"" -s" ;MsgBox(0,"",$sBuildCommand) $Ret = RunWait($sBuildCommand) If $Ret <> 0 Then ShowTrayTip($AppName,"ISM Build Failed, Please build the ISM Manually.",10, $TIP_ICONHAND) MsgBox($MB_OK + $MB_ICONERROR, "Error", "Could not build ""$sOutputIsm$"". Please build manually.") Logging("Error $Ret$ while Building $sOutputIsm$",4) Return;Exit(1) Else ShowTrayTip($AppName,"ISM Build Completed",10, $TIP_ICONASTERISK) Logging("Completed Building $sOutputIsm$",4) if not StringCompare($NewName, "None")=0 then MoveEXE($sFilePath,$NewName) EndIf EndFunc The problem is when we run the ISCmdBuild.exe the RunWait will give whether fail or success but not what are the errors we got.
      If we use Run, it will give that logging but we don't have the feature of getting fail/success as RunWait.
      If we run the above code by removing -s and using redirection operator > to a file, it is running manually but failing with autoit.
      Like
       
      $sBuildCommand = """$sBuildExe$"" -p ""$sOutputIsm$"" -r ""$ReleaseName$"" > c:\logs\uday.log" Any help on this??
       
      And also, in some machines the installshield shortcut is launching fine as licensed version but with ISCmdBld.exe it is giving error as licensing info missing or not registered.
       
      Any suggestion on this too??
    • Eggsplorer
      By Eggsplorer
      Hi,
      I want to install chocolatey (https://chocolatey.org/) with AutoIt.
      I just need to send the following command to cmd:
      @powershell -NoProfile -ExecutionPolicy unrestricted -Command "(iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin This is what I tried:
      RunWait(@ComSpec & " /C " "@powershell -NoProfile -ExecutionPolicy unrestricted -Command "(iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin", ""); It didn't work propably because of the quotes.
      So I tried this:
      $code1 = "@powershell -NoProfile -ExecutionPolicy unrestricted -Command" $code2 = " (iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1" $code3 = " && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" RunWait(@ComSpec & " /C " & $code1 & $code2 & $code3, ""); Didn't work either.
      Any help?
      Thanks in advance =)