Kinan Al-Haffar
asked on
Script to install exe silently
Hi all;
I need to install an Outlook plugin ".exe" file to specific several PCs in the network. The plugin requires the following prerequisites to be installed that I would like to have the script install as well prior to the plugin:
a. MS VSTO 2010 Runtime
b. MS .NET Framework 4.0
I could generate an MSI from the EXE by running : setup.exe /b”<\PathToExtractMSI”>. Once that is done the MSI can be installed silently via the following command: msiexec /i “<\PathToMSI”> /quiet
The plugin comes in 2 architectures "x86 & x64". Therefore; I was wondering if there is a way to create a script "VBS, batch or PS" that would check for Outlook architecture and execute the compatible installer. What's more; the plug in is compatible with Outlook 2010 and above, so we also need to make sure that the script checks for Outlook's version and stop executing the script if the return result isn't Outlook 2010 and above.....
I know that I can check for Outlook architecture by:
if exist "C:\Program Files (x86)\Microsoft Office\Office15\outlook.ex e" set OutlookArch=32
if exist "C:\Program Files\Microsoft Office\Office15\outlook.ex e" set OutlookArch=64
Any suggestions... please advise.
Thanks.
I need to install an Outlook plugin ".exe" file to specific several PCs in the network. The plugin requires the following prerequisites to be installed that I would like to have the script install as well prior to the plugin:
a. MS VSTO 2010 Runtime
b. MS .NET Framework 4.0
I could generate an MSI from the EXE by running : setup.exe /b”<\PathToExtractMSI”>. Once that is done the MSI can be installed silently via the following command: msiexec /i “<\PathToMSI”> /quiet
The plugin comes in 2 architectures "x86 & x64". Therefore; I was wondering if there is a way to create a script "VBS, batch or PS" that would check for Outlook architecture and execute the compatible installer. What's more; the plug in is compatible with Outlook 2010 and above, so we also need to make sure that the script checks for Outlook's version and stop executing the script if the return result isn't Outlook 2010 and above.....
I know that I can check for Outlook architecture by:
if exist "C:\Program Files (x86)\Microsoft Office\Office15\outlook.ex
if exist "C:\Program Files\Microsoft Office\Office15\outlook.ex
Any suggestions... please advise.
Thanks.
ASKER
Thank you so much for the reply. What's more; the goal here is to have one script that runs the whole show:
1. Check the Outlook version and architecture and execute the compatible MSI file based on the result, or exit if Outlook is older than 2007 despite the architecture.
2. Run the msi installer in Silent mode and run the prerequisites prior to the plugin
The script then can be distributed via a GPO for instance...
Please advise.
Thanks again..
1. Check the Outlook version and architecture and execute the compatible MSI file based on the result, or exit if Outlook is older than 2007 despite the architecture.
2. Run the msi installer in Silent mode and run the prerequisites prior to the plugin
The script then can be distributed via a GPO for instance...
Please advise.
Thanks again..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you so much. I will try it and post the results shortly.
ASKER
So I tried the script and it's running fine so far. However; I was wondering how can I based on the Outlook query result direct the script to install the x86 MSI or the x64 MSI?
Please advise.
Thank you.
Please advise.
Thank you.
As outlined in the last example starting in line 43: you can use the variable OutlookBitness, which is either x64 or x86.
Since you're not telling how the x86 and the x64 msi versions differ by name or install folder, that's as much detail as I can provide.
Since you're not telling how the x86 and the x64 msi versions differ by name or install folder, that's as much detail as I can provide.
ASKER
Thank you for your reply. I apologize for not mentioning the required info. Here are the names and locations of both MSI files:
C:\Onyx_360_Install\Onyx36 0_Client_v 7.6.1_x86\ Onyx_360_f or_Outlook _(x86).msi
C:\Onyx_360_Install\Onyx36 0_Client_v 7.6.1_x86\ Onyx_360_f or_Outlook _(x64).msi
Thanks...
C:\Onyx_360_Install\Onyx36
C:\Onyx_360_Install\Onyx36
Thanks...
Then something like this should do the trick (they're really both in the "Onyx360_Client_v7.6.1_x86" folder?).
set PluginMsi=C:\Onyx_360_Install\Onyx360_Client_v7.6.1_x86\Onyx_360_for_Outlook_(%OutlookBitness%).msi
ECHO start "" /wait msiexec.exe /i "C:\%PluginMsi%" /quiet /noreboot /liewa "%Systemroot%\Temp\outlook-plugin.msi"
if %Errorlevel% neq 0 (
if %Errorlevel% equ 3010 (
set Reboot=True
) else (
echo Error %Errorlevel% during installation of the Outlook plugin.
exit /b 1
)
)
ASKER
Thank you.. assuming that they are in different folder, which I assume is better, do I need to have the above mentioned part of the script twice?
C:\Onyx_360_Install\Onyx36 0_Client_v 7.6.1_x86\ Onyx_360_f or_Outlook _(x86).msi
C:\Onyx_360_Install\Onyx36 0_Client_v 7.6.1_x64\ Onyx_360_f or_Outlook _(x64).msi
C:\Onyx_360_Install\Onyx36
C:\Onyx_360_Install\Onyx36
No, you'd just use the variable twice:
set PluginMsi=C:\Onyx_360_Inst all\Onyx36 0_Client_v 7.6.1_%Out lookBitnes s%\Onyx_36 0_for_Outl ook_(%Outl ookBitness %).msi
ECHO start "" /wait msiexec.exe /i "C:\%PluginMsi%" /quiet /noreboot /liewa "%Systemroot%\Temp\outlook -plugin.ms i"
if %Errorlevel% neq 0 (
if %Errorlevel% equ 3010 (
set Reboot=True
) else (
echo Error %Errorlevel% during installation of the Outlook plugin.
exit /b 1
)
)
set PluginMsi=C:\Onyx_360_Inst
ECHO start "" /wait msiexec.exe /i "C:\%PluginMsi%" /quiet /noreboot /liewa "%Systemroot%\Temp\outlook
if %Errorlevel% neq 0 (
if %Errorlevel% equ 3010 (
set Reboot=True
) else (
echo Error %Errorlevel% during installation of the Outlook plugin.
exit /b 1
)
)
ASKER
Thanks... does this seems ok? decided to use a network share for the MSI installers, and have a separate folder for each installer based on the architecture, except for the DotNet since that one installer works for both...
@echo off
setlocal enabledelayedexpansion
set CurVer=
for /f "tokens=3" %%a in ('reg.exe query "HKCR\Outlook.Application\CurVer" /ve ^| find.exe /i "REG_SZ"') do set CurVer=%%a
if "%CurVer%"=="" (
echo No Outlook installation found.
exit /b 1
)
for %%a in (%CurVer:.= %) do set OutlookVersion=%%a
if %OutlookVersion% LSS 14 (
echo This Outlook '%OutlookVersion%' is too old for the plugin.
exit /b 1
)
set OutlookBitness=
for /f "tokens=3" %%a in ('reg.exe query "HKLM\SOFTWARE\Microsoft\Office\%OutlookVersion%.0\Outlook" /v "Bitness" ^| find.exe /i "REG_SZ"') do set OutlookBitness=%%a
if "%OutlookBitness%"=="" (
echo Unable to determine the Outlook bitness; this should not have happened.
exit /b 1
)
echo Detected Outlook version: '%OutlookVersion%'; bitness: '%OutlookBitness%'
set Reboot=False
taskkill /IM outlook.exe
set VstoMsi=\\corpbeacond02\Beacon_Install_Files\Onyx_360_Install\vstor_redist_%OutlookBitness%\vstor_redist_(%OutlookBitness%).msi
start "" /wait msiexec.exe /i "%VstoMsi%" /quiet /noreboot /liewa "%Systemroot%\Temp\Vsto.msi"
if %Errorlevel% neq 0 (
if %Errorlevel% equ 3010 (
set Reboot=True
) else (
echo Error %Errorlevel% during installation of the Microsoft Vsto 2010 Runtime.
exit /b 1
)
)
set DotNetMsi=\\corpbeacond02\Beacon_Install_Files\Onyx_360_Install\dotNetFx40_Full_setup.msi
start "" /wait msiexec.exe /i "%DotNetMsi%" /quiet /noreboot /liewa "%Systemroot%\Temp\DotNet.msi"
if %Errorlevel% neq 0 (
if %Errorlevel% equ 3010 (
set Reboot=True
) else (
echo Error %Errorlevel% during installation of the Microsoft DotNetFx.
exit /b 1
)
)
set pluginMsi=\\corpbeacond02\Beacon_Install_Files\Onyx_360_Install\Onyx360_Client_v7.6.1_%OutlookBitness%\Onyx_360_for_Outlook_(%OutlookBitness%).msi
start "" /wait msiexec.exe /i "%PluginMsi%" /quiet /noreboot /liewa "%Systemroot%\Temp\outlook-plugin.msi"
if %Errorlevel% neq 0 (
if %Errorlevel% equ 3010 (
set Reboot=True
) else (
echo Error %Errorlevel% during installation of the Outlook plugin.
exit /b 1
)
)
if %Reboot%==True (
echo A reboot is required.
)
If the msi paths are OK, then this should work.
ASKER
Thank you so much for your help... I really appreciate it....
Otherwise, you'll have two variables at the end, "OutlookVersion" (14 or higher) and "OutlookBitness" (x86 or x64).
Open in new window
And, for the fun of it, the same in Powershell:
Open in new window
Edit: Added Powershell version.