This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Check for application running when installation
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Mar 13, 2008
04:42 AM
Check for application running when installation
Hi,
I have a problem in MSI basic project. How can i know whether the application is running when i install/uninstall? Is there anywhere that i can check?
Besides, other than using installscript, can i check for the existence of an application and prompt message?
Thanks in advance.
Regards,
HY
I have a problem in MSI basic project. How can i know whether the application is running when i install/uninstall? Is there anywhere that i can check?
Besides, other than using installscript, can i check for the existence of an application and prompt message?
Thanks in advance.
Regards,
HY
(9) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Mar 13, 2008
09:07 AM
MSI will do that for you and will display “File in use” dialog or if some apps doesn’t have the window will schedule reboot at the end. But if you still want to check some specific process when running and don’t want to use InstallScript you may check it in CA using for example VBScript. Here is the example of the script to populate list of processes running on a computer … You may look inside this list your application and warn user if you want.
Hope that what you've asked.
' Process.vbs
' Free Sample VBScript to discover which processes are running
' Author Guy Thomas http://computerperformance.co.uk/
' Version 1.4 - December 2005
' -------------------------------------------------------'
Option Explicit
Dim objWMIService, objProcess, colProcess
Dim strComputer, strList
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery("Select * from Win32_Process")
For Each objProcess in colProcess
strList = strList & vbCr & objProcess.Name
Next
WSCript.Echo strList
WScript.Quit
' End of List Process Example VBScript
Hope that what you've asked.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Mar 18, 2008
02:45 AM
Thank you for your prompt response. 🙂
The checkings done by MSI still can be ignored by users, I'm thinking to abort when application is running.
I found the vbs way is working, but my colleague is facing some error in running vbs at customer site, which unable to reproduce at our side.
So I'm looking for better alternatives. Is there any other way to do so? How could we check this in InstallScript?
Thanks & Regards,
HY
The checkings done by MSI still can be ignored by users, I'm thinking to abort when application is running.
I found the vbs way is working, but my colleague is facing some error in running vbs at customer site, which unable to reproduce at our side.
So I'm looking for better alternatives. Is there any other way to do so? How could we check this in InstallScript?
Thanks & Regards,
HY
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Mar 18, 2008
09:07 AM
To abort installation from VBScript the CA which call a VBScript function should return 3 (Const IDABORT = 3 ) and if you want nicely cancel function should return 2 (Const IDCANCEL = 2 ) . Usually VBScript works fine and as you may see it is very simple code. I met the situation when enterprise unregister vbscript.dll from all computers … this is really not good situation, but live one 😉
May be InstallScript will be better alternative for you and actually it’s easy to check … just use function “Is” :
I have work with InstallScript type of projects and had the same tasks to perform, so give you example of function which checks if Outlook is running …
May be InstallScript will be better alternative for you and actually it’s easy to check … just use function “Is” :
Is(FILE_LOCKED, sPath ^ "myprogram.exe");
I have work with InstallScript type of projects and had the same tasks to perform, so give you example of function which checks if Outlook is running …
function BOOL Is_Outlook_Running()
string sOutlookInstall, sOutlookInstallPathKey, sOutlookInstallPath;
number nType, nSize, nResult;
begin
sOutlookInstall = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\OUTLOOK.EXE";
sOutlookInstallPathKey = "Path";
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
if (RegDBKeyExist (sOutlookInstall) < 0) then
return FALSE;
else
RegDBGetKeyValueEx(sOutlookInstall, sOutlookInstallPathKey, nType, sOutlookInstallPath, nSize);
nResult = Is(FILE_LOCKED, sOutlookInstallPath ^ "OUTLOOK.EXE");
if (nResult = 1 ) then
return TRUE;
else
return FALSE;
endif;
endif;
end;
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Mar 26, 2008
09:40 PM
Hi slava,
Can you advice on how to check whether the vbscript.dll is unregistered from a computer? The vbscript below is supported in my PC but not at customer's site. It prompted Error 1720 for not supporting the script.
Code:
Function ExitSetup()
Const IDABORT = 3
flag = false
Set objProcs = GetObject("winmgmts:").ExecQuery("Select * from Win32_Process where Name = 'MeasurementManager.exe'")
for each Process in objProcs
flag = true
next
if flag = true then
MsgBox "Agilent Measurement Manager is still running and is interfering with Setup." & Chr(13) & "Please exit Agilent Measurement Manager and run Setup again.", 16, "Setup Cannot Continue"
ExitSetup = IDABORT
end if
End Function
-----------------------------------------------------------------------------------------
Update:
I have tried unregister the vbscript.dll in my PC in order to reproduce the issue.
To unregister:
Start-Run- regsvr32 /u vbscript.dll
It caused Error 2738 (meaning could not access VBScript run time for custom action) instead of Error 1720. Is there any extra configuration or settings need to be done in order to block my system from recognizing or running the vbscript?
Thanks in advance!
Regards,
SL
Can you advice on how to check whether the vbscript.dll is unregistered from a computer? The vbscript below is supported in my PC but not at customer's site. It prompted Error 1720 for not supporting the script.
Code:
Function ExitSetup()
Const IDABORT = 3
flag = false
Set objProcs = GetObject("winmgmts:").ExecQuery("Select * from Win32_Process where Name = 'MeasurementManager.exe'")
for each Process in objProcs
flag = true
next
if flag = true then
MsgBox "Agilent Measurement Manager is still running and is interfering with Setup." & Chr(13) & "Please exit Agilent Measurement Manager and run Setup again.", 16, "Setup Cannot Continue"
ExitSetup = IDABORT
end if
End Function
-----------------------------------------------------------------------------------------
Update:
I have tried unregister the vbscript.dll in my PC in order to reproduce the issue.
To unregister:
Start-Run- regsvr32 /u vbscript.dll
It caused Error 2738 (meaning could not access VBScript run time for custom action) instead of Error 1720. Is there any extra configuration or settings need to be done in order to block my system from recognizing or running the vbscript?
Thanks in advance!
Regards,
SL
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Mar 27, 2008
10:25 AM
Well, when vbscript.dll unregister from the computer is very rare and unusual case and I meat it once in one of the corporate customers. So 99% of the computers have VBScript registered. For sure you can check it in a few ways … for example you may create an object (Scripting object?) and check it with IsObject() function; you may looking in registry typelib registration information; I don’t know something like that, but I think it’s overhead. Any system should have VB Scripting.
Now the code you’ve provided is very strange and I am not sure if it works at all. What is the function GetObject("winmgmts:") will return? I am pretty sure you are missing something. But let’s not concentrate on the script and think about methods you used to determine the problem.
The error numbers you’ve provided is the error from installation process, so I assume you are trying to run every time installation other then at the first place check if script itself works. Store your function in .vbs file and start it on the computer. Is it failed? What error, line? Try to identify and collect more information about script or debug it, put message boxes all over the place. If it will work as regular .vbs file you will know nothing wrong with the script and you should look at your installation now. Look at your CA in what content you are calling it, where is it happen ( sequence ).
As you can see you may better identify the problem other than just tell Installation errors.
Now the code you’ve provided is very strange and I am not sure if it works at all. What is the function GetObject("winmgmts:") will return? I am pretty sure you are missing something. But let’s not concentrate on the script and think about methods you used to determine the problem.
The error numbers you’ve provided is the error from installation process, so I assume you are trying to run every time installation other then at the first place check if script itself works. Store your function in .vbs file and start it on the computer. Is it failed? What error, line? Try to identify and collect more information about script or debug it, put message boxes all over the place. If it will work as regular .vbs file you will know nothing wrong with the script and you should look at your installation now. Look at your CA in what content you are calling it, where is it happen ( sequence ).
As you can see you may better identify the problem other than just tell Installation errors.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Apr 07, 2008
06:46 AM
Thanks for the prompt response:)
I have enhance my vbscript line as below. At customer's site, this code can run manually outside of InstallShield.
Set objWMI = GetObject("winmgmts:\\.\root\cimv2")
However,I would like to include msgBox to pinpoint the exact line error just in case the Error 1720 occur when it runs inside the custom action of InstallShield.
Error 1720 should have the msg details as the following:
There is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your support personnel or package vendor. Custom action [2] script error [3], [4]: [5] Line [6], Column [7], [8].
How can I get the information of the last line prompted? As for now, the error 1720 prompted at customer's site did not locate the line and column of the error.
Thanks for your advice:)
I have enhance my vbscript line as below. At customer's site, this code can run manually outside of InstallShield.
Set objWMI = GetObject("winmgmts:\\.\root\cimv2")
However,I would like to include msgBox to pinpoint the exact line error just in case the Error 1720 occur when it runs inside the custom action of InstallShield.
Error 1720 should have the msg details as the following:
There is a problem with this Windows Installer package. A script required for this install to complete could not be run. Contact your support personnel or package vendor. Custom action [2] script error [3], [4]: [5] Line [6], Column [7], [8].
How can I get the information of the last line prompted? As for now, the error 1720 prompted at customer's site did not locate the line and column of the error.
Thanks for your advice:)
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Apr 07, 2008
09:17 AM
Unfortunately I don’t know how to display such detail information from VBScript error object of CA on installshield error reporting level:(. Never done it because of two reasons … One is such message is not “nice” for end user and if you want to get more information you just need to use log. Second is if the script may fail on customer side, something wrong with this script and you more likely need to put more time to make it stable other than report about problems to end user. Also you may want to wrap script with …
to “hide” the problem of your script for your customers. If such details you would want to provide anyway, you may need open new thread and ask again about this, someone else may help you.
One more note regarding the script. The line you improve is still has a good chance to fail, because your level Impersonation is not set and this means the script will use default one. So there may be difference when you run the script from inside of CA or as stand along. You may read more about it from MSDN website http://msdn2.microsoft.com/en-us/library/aa393852(VS.85).aspx which actually recommends set this level to “impersonate”. Here is the quote: “Impersonate-level COM impersonation level that allows objects to use the credentials of the caller. This is the recommended impersonation level for WMI calls.”.
Well didn’t help you a lot, but this is what I would do … just try to make script stable or search for alternative.
On Error Resume Next
to “hide” the problem of your script for your customers. If such details you would want to provide anyway, you may need open new thread and ask again about this, someone else may help you.
One more note regarding the script. The line you improve is still has a good chance to fail, because your level Impersonation is not set and this means the script will use default one. So there may be difference when you run the script from inside of CA or as stand along. You may read more about it from MSDN website http://msdn2.microsoft.com/en-us/library/aa393852(VS.85).aspx which actually recommends set this level to “impersonate”. Here is the quote: “Impersonate-level COM impersonation level that allows objects to use the credentials of the caller. This is the recommended impersonation level for WMI calls.”.
Well didn’t help you a lot, but this is what I would do … just try to make script stable or search for alternative.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Apr 08, 2008
07:04 AM
Thanks a lot for the useful information shared:)
Meanwhile I have also created the log file for helping me to debug.
Steps:
1. Go to Installation Designer > Media > Releases
2. Under Product Configuration > Release1
3. Find the property "MSI Command Line Arguments" at the right panel
4. Fill in : /L*v "%SYSTEMDRIVE%\LogFile.log"
As a result, the log file will be created at C drive. If Error 1720 occurs during installation, log file will be created with the custom action script error logged.
Hope this helps:)
Thanks a lot!
Meanwhile I have also created the log file for helping me to debug.
Steps:
1. Go to Installation Designer > Media > Releases
2. Under Product Configuration > Release1
3. Find the property "MSI Command Line Arguments" at the right panel
4. Fill in : /L*v "%SYSTEMDRIVE%\LogFile.log"
As a result, the log file will be created at C drive. If Error 1720 occurs during installation, log file will be created with the custom action script error logged.
Hope this helps:)
Thanks a lot!
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Apr 30, 2008
05:59 AM
Hi Mr. Slava,
I have written a LaunchReadMe Install Script and try to link it to the Setup Complete Success Dialog "OK" button but it fails to launch the html file, seems like my installscript did not link up with the control in my dialog.
The below are my setting at Setup Complete Success Dialog Behaviour:
1. At "OK" Control: Event: Do Action , Argument: LaunchReadMe, Condition: LAUNCHREADME="-1" And READMEFILETOLAUNCHATEND <>"" And NOT Installed And NOT ISENABLEDWUSFINISHDIALOG
2. At CheckLaunchReadMe (CheckBox), I set Property Is Integer to True and Property = LAUNCHREADME.
InstallScript:
LaunchApp(PROGRAMFILES ^ "Internet Explorer" ^ "iexplore.exe",INSTALLDIR ^ "Docs" ^ "Release_Notes.htm");
I am sure that the installscript is running well because I have added message box to test and it is running well when I put the sequence "After InstallFinalize".
Any solution for this? Looking forward for your reply.Thanks in advance!!
I have written a LaunchReadMe Install Script and try to link it to the Setup Complete Success Dialog "OK" button but it fails to launch the html file, seems like my installscript did not link up with the control in my dialog.
The below are my setting at Setup Complete Success Dialog Behaviour:
1. At "OK" Control: Event: Do Action , Argument: LaunchReadMe, Condition: LAUNCHREADME="-1" And READMEFILETOLAUNCHATEND <>"" And NOT Installed And NOT ISENABLEDWUSFINISHDIALOG
2. At CheckLaunchReadMe (CheckBox), I set Property Is Integer to True and Property = LAUNCHREADME.
InstallScript:
LaunchApp(PROGRAMFILES ^ "Internet Explorer" ^ "iexplore.exe",INSTALLDIR ^ "Docs" ^ "Release_Notes.htm");
I am sure that the installscript is running well because I have added message box to test and it is running well when I put the sequence "After InstallFinalize".
Any solution for this? Looking forward for your reply.Thanks in advance!!
![](/skins/images/B841502EC6C60E3ACD181F0696AD21B9/responsive_peak/images/icon_anonymous_message.png)