check system condition before install a prerequisite in install shield - installshield

Our installer which is created using installshield as installscript MSI project type will install SQL Express 2014 SP(x64) as a prerequisite. However, when the system has a pending reboot, SQL express installation will fail. We would like the installer to check if the system has a pending reboot before installing SQL express. Currently, SQL express is defined as setup prerequisite.
what is the best way to make this checking to happen before SQL Express installation?
The following code checks the system pending reboot condition and it works as expected.
function CheckSystemReboot(hMSI)
OBJECT objSysInfo;
string szMsg;
NUMBER nReturn;
begin
// TODO: Perform custom initialization steps, check requirements, etc.
set objSysInfo = GetObject("");
set objSysInfo = CreateObject("Microsoft.Update.SystemInfo");
if IsObject(objSysInfo) then
if objSysInfo.RebootRequired then
szMsg ="A system reboot is pending. Please reboot your system before
installing this product";
MessageBox ( szMsg , SEVERE );
return ERROR_INSTALL_FAILURE;
else //test only
szMsg = "A system reboot is not needed";
MessageBox ( szMsg , SEVERE );
return ERROR_SUCCESS ;
endif;
endif;
end;

The Installscript MSI project type is riddled with bugs and problems - just so that has been communicated. Particularly relating to upgrade scenarios in my experience. I would never use this project type.
Apart from that it is not clear what you are asking if that script works? I suppose you could have a look at what these scripts are doing (the registry locations they check):
https://gallery.technet.microsoft.com/scriptcenter/Get-PendingReboot-Query-bdb79542
https://gist.github.com/altrive/5329377
http://www.itninja.com/question/how-to-check-if-there-is-a-pending-reboot
https://gallery.technet.microsoft.com/scriptcenter/xPendingReboot-PowerShell-b269f154
Maybe update your question if this is not what you are asking?

Related

What to do when I accidentally cancel oracle 19c installation on CentOS

Today is my first day using Linux. I was given a task to install OracleDB 19c on our company server running CentOS 8.
When the installation was almost done, the loading bar was at 86% and the title said "completing database creation" I accidentally press "X" and close the program.
Now I wonder, when I come back to the company tomorrow, what I will have to do to re-install Oracle 19c. Will I have to go find and delete thousands of created files, or just simply install the db again and Oracle will overwrite all existed files?
I was following this guide https://oracledbwr.com/step-by-step-oracle-19c-installation-on-linux/ and finished step 13 when the incident occurred.
" was following this guide" I've never understood why people look for some specious 3d-party guide to installation. Why not use the actual, official, installation guide?
The default installation is actually two separate and distinct operations. The first installs the oracle software. The second creates a database. When installing I always make the selection to not create the database. Once the software is successfully installed, I come back and launch the dbca (DataBase Creation Assistant) to create the database as a completely separate operation.
Since you say that the status was "completing database creation", that means that the installation was completed and the installer had already launched DBCA. Therefore you do not have to clean up or reinstall oracle. You only have to drop the incompletely created database.
BTW, you say this is your first to use Linux - implying that you've worked with Oracle on Windows. But this usage of installer and dbca is really no different. Once you get to runInstaller, the operation of the installer and dbca is exactly the same on either platform.

In Inno Setup, how to rollback a "verysilent" installation?

I have created an installer using Inno Setup. The installer uses a packaged-in DLL to check availability of a specific device on the target machine. If the device is found, the installation is allowed to finish, otherwise the installation is rolled-back (rollback is done using below lines in script):
if <DeviceNotFound> then
begin
CancelWithoutPrompt := true;
WizardForm.Close;
end;
I have checked that the above check and rollback logic works fine if the setup is run with /silent cmd line param. However, when I use /silent param, the setup displays the Installation progress wizard form.
Also, I found that if I run the above setup in /verysilent mode, then the "DeviceNotFound" check logic works fine but the rollback logic doesn't work and it seems as if rollback logic doesn't get executed at all. Instead of performing rollback, the installer successfully installs.
Now, I have a requirement to run the setup silently so that no window is displayed but it must install or rollback based on device check. Therefore, I have the below queries:
Can I rollback the installer when it is running in /verysilent mode? If so, please advise how it may be achieved. I can detect verysilent install mode as shown in question:
How to detect whether the setup runs in very silent mode?
Alternatively, can I Hide/Minimize the Installation progress window when it is running in /silent mode? If so, please advise how it may be achieved.
Please help me with my above queries.
Sorry to be so descriptive but I tried to explain my problem and queries!
EDIT
I am not doing the above mentioned check in InitializeSetup(). I am doing the check from a function invoked by AfterInstall directive from [Files] section. I have a limitation that I cannot do it from InitializeSetup() as the packaged-in DLL is not extracted till [Files] section completes. I also need to run the installer in Windows PE (Preinstallation Environment), hence I cannot use ExtractTemporaryFile() function to forcefully extract the DLL because the {tmp} path is not valid in that environment. That leaves me with only one option is to check after [Files] section is done. Please advise!
Your constraint on not using ExtractTemporaryFile does not make sense.
The Inno Setup installer always creates a temporary folder for the installation.
2015-07-31 09:02:07.458 Created temporary directory: C:\Users\martin\AppData\Local\Temp\is-1CN29.tmp
If it is not possible to create the folder, the installation fails.
The Inno Setup tries to create the temporary folder in these locations:
%TMP%
%TEMP%
%USERPROFILE%
Windows installation folder (C:\Windows)
At least the last path has to exist even in the "Windows PE".
So I do not think, there's anything preventing you from using the ExtractTemporaryFile function.

launching application after silent install

Installshield 2014 professional: Basic MSI (NOT setup.exe)
Using Project assistant, I set launch application checkbox (default TRUE) on SetupCompleteSuccess dialog.
Usually it works fine.
But on silent mode, it does not work.
How and When can I call IS_LAUNCH_MY_PROGRAM_PLEASE custom action or execute application on installed dirctory.
As an aside, my reaction to this is that you shouldn't do it. If you do, it should be conditional and require the person installing your software to include a property on the command line that requests the program launch.
That said, the problem is that the dialogs are not shown during a silent installation (Windows Installer skips the entire InstallUISequence), so the actions on them will never run. Instead you'd have to schedule a custom action in the InstallExecuteSequence, and use UILevel (and a custom property) to condition when this action runs.
Note that there's a strong likelihood that this will run your application in the wrong context, or even as the wrong user, as typically one has to pre-elevate in order for a silent installation to succeed. So again, keep the request to install an application and the request to run it separate. People using systems like SCCM will curse your installation otherwise.

Deploy a windows service without Installshield

Is it possible to deploy a windows service without going through Installshield? I have a very basic service which simply probes a database, and wish to deploy it on a server.
I tried using Installsheild LE, but get error 1001 on install, which is hard to troubleshoot, and anyhow Installshield feels like overkill in this case... is there a way can just install the service direct by command line or other method?
Yes.
However, there are options, from best to worst:
There are other tools for writing installers out there. Eg. the full version of install Shield or WiX (which MS created, and is used for the Visual Studio installer).
You could use installUtil having included a type derived from ServiceInstaller in your assembly. (See How to: Install and Uninstall Service.)
You can manually edit the registry.
#3 Is seriously easy to mess up, and won't help you with the event logging and performance counters you should be including.1 #2 is best in development, and will set up event logs and performance counters as well (remember you'll need to elevate to install things, and to attach a debugger to the service when running as a service).
Using a real installer (#1) is best in test (staging) and production environments.
1 When you get asked why it isn't working, you'll want to be able to work out what's going on (or not).
Yes, if your service has an Installer class then, you can install it from command line with installutil.exe
using System.ComponentModel;
using System.Configuration.Install;
using System.ServiceProcess;
[RunInstaller(true)]
public class ServiceInstaller : Installer
{
public ServiceInstaller()
{
ServiceProcessInstaller serviceProcessInstaller = new ServiceProcessInstaller();
ServiceInstaller serviceInstaller = new ServiceInstaller();
//# Service Account Information
serviceProcessInstaller.Account = ServiceAccount.User;
serviceProcessInstaller.Username = "";
serviceProcessInstaller.Password = "";
//# Service Information
serviceInstaller.DisplayName = "Service name"
serviceInstaller.Description = "Service description"
serviceInstaller.StartType = ServiceStartMode.Automatic;
//# This must be identical to the WindowsService.ServiceBase name
//# set in the constructor of WindowsService.cs
serviceInstaller.ServiceName = "Service Name";
this.Installers.Add(serviceProcessInstaller);
this.Installers.Add(serviceInstaller);
}
}
Building and Deploying a Windows Service using IsWiX
The above is a short video I made showing how to use WiX / IsWiX to generate a very clean MSI for installing a service. It's really easy, fast, elegant and free.
You can use the command line tool sc.exe to create and configure a windows service (basically insert the config into registry), assuming you have already deployed the built .exe to disk somewhere on your server.
http://support2.microsoft.com/kb/251192

Run executable as admin in InstallScript

I am using the following script to run an executable as an admin:
#include "ifx.h"
export prototype MyFunction(HWND);
///////////////////////////////////////////////////////////////////////////////
//
// Function: MyFunction
//
// Purpose: Calls into Companion to execute the detect camera and all init setup
// code
//
///////////////////////////////////////////////////////////////////////////////
function MyFunction(hMSI)
begin
if REMOVEALLMODE ==0 then //only run if they are installing the product
LAAW_SHELLEXECUTEVERB = "runas";
LaunchApplication (INSTALLDIR ^ "Companion.exe",
"-detect -test -wsdl -exit -nimbus",
"",
SW_NORMAL,
0,
LAAW_OPTION_WAIT_INCL_CHILD | LAAW_OPTION_USE_SHELLEXECUTE);
endif;
end;
On XP, the script above will open up a dialog box asking the user which user the executable should be run as. This allows them to select an admin to run the executable. However, on Windows 7, nothing happens. The installation doesn't ask the user for anything and the installation fails.
Any ideas on why this might be or any other suggestions as to how to run an executable as an admin?
What happens when you launch the application yourself under Win7, I mean outside of InstallShield?
I am thinking it might be due to UAC. A program launched by an installscript doesn not automatically inherit admin privileges from the installshield script.
You can distinguish between XP and all non-XP operating systems like this:
if ( SYSINFO.WINNT.bWinXP ) then
LAAW_SHELLEXECUTEVERB = "open"; // target PC is on Windows XP
else
LAAW_SHELLEXECUTEVERB = "runas"; // Windows 7 (or Vista)
endif;
Here's a Tip from the InstallShield Help Library:
If you are using LAAW_OPTION_USE_SHELLEXECUTE on systems running
Windows Vista or later and you want to launch the application using
the full administrator account (similar to right-clicking the
executable file to be run and clicking Run as Administrator), set
LAAW_SHELLEXECUTEVERB to runas before using LaunchApplication in your
script:
LAAW_SHELLEXECUTEVERB = "runas";
This ensures that the application is always run with full
administrator privileges regardless of whether the application to be
launched has an application manifest with relevant settings. Note that
this may trigger a User Account Control (UAC) prompt for consent or
credentials.
On systems running operating systems earlier than Windows Vista, if
runas is used, a Run As dialog box is displayed. The behavior is
similar to right-clicking the executable file to be run and clicking
Run As. This dialog box enables the end user to select the user
account that should be used to run the application.

Resources