Eagle710 Posted February 15, 2011 Posted February 15, 2011 (edited) I am trying to run a msi installing as such: Run("msiexec.exe /package c:\test.msi /passive") ProcessWaitClose("msiexec.exe" The ProcessWaitClose works fine for WUSA.exe and other things whatever they may be like notepad.exe but when I try and use this ProcessWaitClose with the msiexec.exe it never detects that the process has stopped running. How if any would I be able to work around this? I am not very familiar with looping but perhaps a ProcessExists in a loop would work more efficiently? Any assistance would be greatly apperciated. Edited February 15, 2011 by Eagle710
somdcomputerguy Posted February 15, 2011 Posted February 15, 2011 This code works OK on my machine, does this work for you? While 1 If ProcessWaitClose("msiexec.exe") Then ConsoleWrite("Yay!" & @LF) ExitLoop EndIf Sleep(100) WEnd Oh yeah, 'msiexec.exe' needs to be running before the script is run.. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
Eagle710 Posted February 16, 2011 Author Posted February 16, 2011 (edited) Oh yeah, 'msiexec.exe' needs to be running before the script is run..Does this mean it hsa to be called outside my script or just before this loop runs?Something I noticed when outputting the variable of ProcessRun which is the PID of the process. Msiexec.exe uses two processes to run. One using my username and the other using the System. Although the immediate msiexec.exe closes the other ones remain active for quite sometime afterwards.Any idea how I can handle this one? Edited February 16, 2011 by Eagle710
Gideon Posted February 16, 2011 Posted February 16, 2011 (edited) $pid = ProcessWait("msiexec.exe", 99999);wait for msiexec to run (don't know how long it can wait but 99999 seconds will be enough I think) While 1 If ProcessWaitClose($pid) Then ConsoleWrite("Yay!" & @LF) ExitLoop EndIf Sleep(100) WEnd Edited February 16, 2011 by Gideon Many times you need to think like hobby-bob:')
Eagle710 Posted February 16, 2011 Author Posted February 16, 2011 Gideon, Will this consider both processes running?
Gideon Posted February 16, 2011 Posted February 16, 2011 Maybe I don't understand your question because I'm dutch The first msiexec.exe that is running will get in the string $pid, so you can't wait for another msiexec in the loop. Your script will sleep before msiexec is running and while the it's running Many times you need to think like hobby-bob:')
AdamUL Posted February 16, 2011 Posted February 16, 2011 Use RunWait and instead of Run and ProcessWaitClose. RunWait("msiexec.exe /package c:\test.msi /passive")If you must use Run and ProcessWaitClose then do the following:$iPID = Run("msiexec.exe /package c:\test.msi /passive") ProcessWaitClose($iPID)Adam
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now