Jump to content

Cannot execute a .msi file?


Recommended Posts

I'm trying to run/execute and .msi setup file, more specifically WindowsDefender.msi. However, I get the error Unable to execute the external program.: :rambo:

Autoit doesn't support .msi file? I'm clueless on this.

Much appreciated for the help. :rolleyes:

By the way, when I click start/run and typed in the whole directory, it ran. So I assume the run in autoit script editor is different than that in Windows?

-dreamzboy-

Link to comment
Share on other sites

  • Moderators

Try ShellExecute()

Or

Run(@Comspec & ' /c "' & $hMSIFile & '"', '', @SW_HIDE)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Thanks smoke.

I was able to get the program executed, however, it doesn't continue the script. Could anyone show me how?

Here's my script:

Opt ("TrayIconDebug", 1)

defender_install ()

Func defender_install ()

ShellExecute ("\\3parfiles\DEPT\IT\Public\Software\WindowsDefender\WindowsDefender.msi")

;Sleep (2000)

If Not WinActive ("Open File - Security Warning", "Do you want to run this file?") Then WinActivate ("Open File - Security Warning", "Do you want to run this file?")

WinActive ("Open File - Security Warning", "Do you want to run this file?")

Sleep (750)

Send ("!r")

WinWaitActive ("Windows Defender", "Welcome to the Installation Wizard")

Sleep (750)

Send ("!n")

WinWaitActive ("Windows Defender", "Validate your Genuine Copy")

Sleep (750)

Send ("!v")

WinWaitActive ("Windows Defender", "Windows Defender License Agreement")

ControlClick ("Windows Defender", "I &accept", 32)

Sleep (750)

Send ("!n")

WinWaitActive ("Windows Defender", "Help protect Windows")

ControlClick ("Windows Defender", "&Install definition", 589)

Sleep (750)

Send ("!n")

WinWaitActive ("Windows Defender", "Setup Type")

Sleep (750)

Send ("!n")

WinWaitActive ("Windows Defender", "Ready to Install Windows Defender")

Sleep (750)

Send ("!i")

WinWaitActive ("Windows Defender", "Windows Defender Install Complete")

ControlClick ("Windows Defender", "", 494)

Sleep (750)

Send ("!f")

EndFunc

And it got stuck here:

Posted Image

btw, the scrip button on in this forum doesn't work so that's why my script it's not as neat.

Thanks again.

-dreamzboy-

Edited by dreamzboy
Link to comment
Share on other sites

  • Moderators

I've never played with this before, but seems to me that you should be able to:

ShellExecute('\\3parfiles\DEPT\IT\Public\Software\WindowsDefender\WindowsDefender.msi','qn') and skip all the controlclicks and winwaits?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

First off, yes the autoit tags DO work, and second did you mean WinWaitActive instead of WinActive, and also did you try just pressing Alt-r on your own to see if that even works?:

If Not WinActive ("Open File - Security Warning", "Do you w[È[È[OÉ][ÝÊH[Ú[XÝ]]H
    ][ÝÓÜ[[HHÙXÝ]HØ[É][ÝË  ][ÝÑ2÷RvçBFò'VâF2fÆSògV÷C²¥vä7FfRgV÷C´÷VâfÆRÒ6V7W&Gv  ¹¥¹ÅÕ½Ðì°ÅÕ½Ðí¼å½ÔݹÐѼÉոѡ¥Ì¥±üÅÕ½Ðì¤ìM½µµ¹Ð¥¸½õm
Sleep (750)
Send ("!r") ; See comment in forum
Link to comment
Share on other sites

Are you sure you can see the "r" underlined when you press Alt key? - Send ("!r")

If you do then try to shorten the window title and window text to a minimum and add the line: Opt("WinTitleMatchMode", 2)

If you don't then try to get the focus on Run button by using TABs or arrow keys and Send ("{ENTER}")

This should solve the hangout.

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

Thanks for the input. :rolleyes:

1. If you use "If WinWaitActive," your script will not work as I have tried a thousand times along with others because your script execute faster than the programs itself.

2. Regardless if I use your method or mine, the debug tray icon stops at this line "ShellExecute ("\\3parfiles\DEPT\IT\Public\Software\WindowsDefender\WindowsDefender.msi")," therefore, WinWaitActive was never triggered.

3. Yes, by pressing Alt+R does bring me to the next screen and if that screen is active, my script will continue on its way.

So the problem here lies between Executing the program and WinWaitActive.

Please keep in mind that this is not an .EXE file but it's a .MSI file.

Link to comment
Share on other sites

Yeah - danwilly is right. I fyou use this:

Run("msiexec.exe \\3parfiles\DEPT\IT\Public\Software\WindowsDefender\WindowsDefender.msi")

it will work (used that myself for an install script and it worked just fine)

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

Thanks for the input. :rolleyes:

1. If you use "If WinWaitActive," your script will not work as I have tried a thousand times along with others because your script execute faster than the programs itself.

2. Regardless if I use your method or mine, the debug tray icon stops at this line "ShellExecute ("\\3parfiles\DEPT\IT\Public\Software\WindowsDefender\WindowsDefender.msi")," therefore, WinWaitActive was never triggered.

3. Yes, by pressing Alt+R does bring me to the next screen and if that screen is active, my script will continue on its way.

So the problem here lies between Executing the program and WinWaitActive.

Please keep in mind that this is not an .EXE file but it's a .MSI file.

I've never had any luck with WinWaitActive. I always use WinWait.

Also, try kicking off the MSI silently as Smoke alluded to earlier. Using /qn should work but /quiet /passive /norestart might be available too. All MSI files that I scripted I have done silently to avoid the same hell you are facing. :rambo:

Support bacteria; it's the only culture most people have.LxP's Learning to Script with AutoIt 3 - Excellent starting placeVolly's Links Page - Links to cool and useful scriptsAutoIt Wrappers - Valuater's AutoIt Wrappers post. Lots of good stuff.Support AutoIt - Make a donation here; I did.[size="2"]#include <Guinness.pint>[/size]

Link to comment
Share on other sites

Thank you Smoke, KSmith, and everyone who confirmed. I used ShellExecute ("\\3parfiles\DEPT\IT\Public\Software\WindowsDefender\WindowsDefender.msi") and it works like a charm.

Interesting topic with the silent install. Gotta catch up on reading.

:rolleyes:

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