Sample Logon installation script

The following script demos how to leverage logon scripts to check whether the Actifile agent is installed, and if not, install it quietly.
Note: You must ensure that the agent MSIName and MSIEXEC command lines are pointing at a LAN accessible install package and that the correct tenant installkey is selected.

REM ===================DEFINE MSI,UPN,log file & folder here==============
SET MSINAME=ActifileAgent.msi (Full path to the installation file)
SET UPN=Actifile
SET LOGSFOLDER="C:\ApplicationLogs\%UPN%_Install.log"
IF NOT EXIST "C:\ApplicationLogs" MD "C:\ApplicationLogs"

REM ===================Check if the Product exists already==================
SET PRODUCTKEY=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
REG QUERY %PRODUCTKEY%\{0D13F554-E542-4590-AACB-AA60CAE75A64}
IF NOT %ERRORLEVEL% EQU 0 (GOTO :INSTALL) ELSE GOTO :ENDHERE 

REM =======================Install  the application========================
:INSTALL
MSIEXEC.EXE /I "C:\Users\Simon Chulsky\Dropbox\Actifile\Deployment\ActifileAgent.msi" installkey=1234-12345-ABCD-EFGH /quiet
set MSIERROR=%errorlevel%
if %MSIERROR%==0 GOTO :ENDHERE
if %MSIERROR%==1641 GOTO :ENDHERE
if %MSIERROR%==3010 GOTO :ENDHERE
GOTO :ERROR

REM ================ Installation successful. Write to Event Log==================
:ENDHERE
EVENTCREATE /l Application /so %UPN%-Install-SUCCESS /t SUCCESS /id 1000 /d "Actifile Application installed successfully."
Exit 0

REM ================ Installation failed. Write to Event Log======================
:ERROR
EVENTCREATE /l Application /so %UPN%-Install-FAILED--(ERROR=%MSIERROR%) /t ERROR /id 999 /d "Actifile Application installation failed."
Exit %MSIERROR%

Powered by BetterDocs