Beekman Posted February 16, 2013 Share Posted February 16, 2013 (edited) Hello, Can anybody help me. I am very new at this. We have a situation that our company is using two distribution channels. Wintel group is using SCCM and we are using Autoit scripts. Because Msiexec.exe only can runnig ones on a computer our installations are getting interrupted. So therefore I want to put a check in the autoit script that checks if the msiexec.exe is runing and if it is running then wait until this process is done or stopt and then starts our installation. Our script : $cmd1 = 'c:\temp\mcupgrade\install\setup /s /v"/qb-"' $cmd2 = 'c:\temp\mcupgrade\elevate c:\temp\mcupgrade\fixpack\setup /s /v"/qb+"' Local $size1 = FileGetSize("c:\temp\mcupgrade\install\setup.exe") Local $size2 = FileGetSize("c:\temp\mcupgrade\fixpack\setup.exe") If $size1 = 173408 And $size2 = 7219000 Then Local $pid = RunAsWait("administrator account",<password>,"",'"' & @ComSpec & '" /c ' & $CMD1, @SystemDir) ProcessWaitClose($pid) RunAsWait("administrator account",<password>,"",'"' & @ComSpec & '" /c ' & $CMD2, @SystemDir) EndIf Edited February 16, 2013 by Melba23 Added code tags Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 16, 2013 Moderators Share Posted February 16, 2013 (edited) Beekman,Welcome to the AutoIt forum. ProcessExists would seem to be the answer to your problem: While 1 ; If the process is not running If Not ProcessExists("msiexec.exe") ; Break out of the loop ExitLoop EndIf ; Wait a second Sleep(1000) WEnd ; We get here if msiexec is not runningAll clear? M23Edit: When you post code please use Code tags - put [autoit] before and [/autoit] after your posted code. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. Edited February 16, 2013 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Beekman Posted February 16, 2013 Author Share Posted February 16, 2013 (edited) Hello Melba23, Many thanks for the quick response. But I have still 2 question. 1. You do a check if the process not exists, but what happens in this script if the process exists? Is this going to wait until the process stops? 2. Is there a possiblility to suppress the UAC from Windows 7 with a autoit command or parameter? Edited February 16, 2013 by Beekman Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 16, 2013 Moderators Share Posted February 16, 2013 Beekman,1. You stay in the While...WEnd loop if the process exists - that is why we have the Sleep in there so you do not check too often. 2. Adding #RequireAdmin to your script will force admin credentials to be entered at the start of the script. You will understand that simply suppressing UAC from a script is not something that can (or indeed should) be done. Search the forum and you will find plenty of tips on how to make UAC as inobtrusive as possible. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 18, 2013 Moderators Share Posted February 18, 2013 As the msiexec process can continue within Task Manager after an installation is run (even if it is not chewing up any CPU), and you mention you have SCCM in the environment, I would suggest a different method. I would check on the CPU usage of the CCMExec process to determine whether SCCM is installing anything. Something like this should work: $wbemFlagReturnImmediately = "&h10" $wbemFlagForwardOnly = "&h20" $PC = "PCName" $WMI = ObjGet("winmgmts:\\" & $PC & "\root\CIMV2") $aProcess = $WMI.ExecQuery("SELECT * FROM Win32_PerfFormattedData_PerfProc_Process", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) For $element in $aProcess If $element.Name = "CCMExec" Then MsgBox(0, $element.Name, $element.PercentProcessorTime & "%") Next "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Beekman Posted February 23, 2013 Author Share Posted February 23, 2013 Thxx Jlogan, I'am going to try both solutions Link to comment Share on other sites More sharing options...
Beekman Posted March 5, 2013 Author Share Posted March 5, 2013 (edited) Hi Melba23, What will the statement be if I want to exit script if process msiexe.exe exist and if not contineu script. Is that. if ProcessExists("msiexec.exe") Then Msgbox(0,"Information","Notes wordt niet geupdate omdat, er een ander programma wordt geinstalleerd") Exit endif Edited March 5, 2013 by Beekman Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 5, 2013 Moderators Share Posted March 5, 2013 Beekman,As you have it, but without the trailing "." after Exit. M23 Beekman 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Tripredacus Posted March 6, 2013 Share Posted March 6, 2013 As the msiexec process can continue within Task Manager after an installation is run (even if it is not chewing up any CPU)It will continue for approximately 10 minutes. I ran into this problem with msiexec staying resident in my installer script. The problem is that if you use RunWait on something that launches the msiexec as a child, then exits, if you don't wait for msiexec to exit normally and reboot, the installation can fail. The Infineon TPM installer is one example of this problem. You can find some details of this if interested:http://www.msfn.org/board/topic/151373-msiexec-taking-a-long-time-to-complete/page__view__findpost__p__971399 Twitter | MSFN | VGCollect Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 6, 2013 Moderators Share Posted March 6, 2013 (edited) It will continue for approximately 10 minutes. I ran into this problem with msiexec staying resident in my installer script. The problem is that if you use RunWait on something that launches the msiexec as a child, then exits, if you don't wait for msiexec to exit normally and reboot, the installation can fail. The Infineon TPM installer is one example of this problem. You can find some details of this if interested:http://www.msfn.org/board/topic/151373-msiexec-taking-a-long-time-to-complete/page__view__findpost__p__971399That is why, as the OP is using SCCM, I suggested looking at the CCMExec process, rather than msiexec.Edit: spell check Edited March 6, 2013 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
LarryDalooza Posted March 6, 2013 Share Posted March 6, 2013 (edited) I believe there will be two msiexec.exe processes. One that is the installation (msiexec.exe) in the users context and one that is the installer service (msiexec.exe) in the SYSTEM context. Also, I believe there may be a registry key that is set while the install is running. That key is cleared by the installer when it is finished. I used to use it, I will try to dig it up. Lar. edit: HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionInstallerInProgress Edited March 6, 2013 by LarryDalooza AutoIt has helped make me wealthy Link to comment Share on other sites More sharing options...
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