Batch Script to install any plugin or any solution MSI from Logon Script
search cancel

Batch Script to install any plugin or any solution MSI from Logon Script

book

Article ID: 161553

calendar_today

Updated On:

Products

Software Management Solution IT Management Suite

Issue/Introduction

Batch Script to install any plugin or any solution MSI if the we are unable to install it from install policy. The script can be ran as a logon script or if the Job and Task is working we can send it as a run script task from SMP.

 

 

Environment

ITMS 7.x

Resolution

 How to use:

  • Copy the script in the notepad and save the file with an extension .bat.
  • If you want to run it as a logon script refer to instruction in http://technet.microsoft.com/en-us/library/cc779329%28v=ws.10%29.aspx  
  • If want to run it as a run script task, Go to SMP Console>Manage>Jobs and Tasks, Right Click>New>Task> Create New Task>Run Script, Select type as Command Script. (Refer to HOWTO45142 for more details on creating task)
  • Change or Modify the UNC to your respective Notification server or Package server.
  • <Package>_x64 and <Package>_x86.msi is the name of MSI package.
  •  This same script can be used to install an exe file as well, the only change would be instead of “misexec.exe /q /I”  use “start "" /MIN /wait x:\Installer.exe -s -a”.
  •  This script is designed to creates a txt file in the “C:\Program Files\Altiris\Altiris Agent\” directory for reference so that it ends the execution if the script was already used in past to install some MSI plugin or solution.
  • Delete the installSMPlugin.txt  if you want to re-ran the script on same machine.    

Script:

@echo off

REM Checking Windows Architecture

REM Here we checking if %PROCESSOR_ARCHITECTURE% contain .86 or .64 symbols

REM you can use SET command to find all other system variables

echo Checking Windows OS architecture...

echo %PROCESSOR_ARCHITECTURE%  | findstr /i ".64." > nul

IF %ERRORLEVEL% EQU 0 goto ver_64

goto ver_32

REM if OS architecture x86 found we installing x86 compatible .MSI package:

REM msiexec.exe /q  /i where /q is quite and /i is installation

REM package_x64 and package_x86.msi is the name of MSI package

REM Modify the UNC Path based on your SMP or Package Server location

REM otherwise you should define absolute path to the MSI package

:ver_32

echo 32 bit detected

echo Installing application...

if exist "C:\Program Files\Altiris\Altiris Agent\installSMPlugin.txt" goto :end

net use u: "\\SMP-W2K8-01.EPM.LOCAL\NSCap\Bin\Win32\X86\Software Management\Plugin"

msiexec.exe /q  /i "u:\SoftwareManagementSolution_Plugin_x86.msi"

TIMEOUT 30

REM Cleanup; Timestamp reinstall (for future check) and un map drive share

TIME /T > "C:\Program Files\Altiris\Altiris Agent\installSMPlugin.txt"

net use u: /DELETE

:end

REM comment "pause" if you don't need "Press any key to continue"

pause

exit

REM if OS architecture x64 found we installing x86 compatible .MSI package:

:ver_64

echo 64 bit detected

echo Installing application...

if exist "C:\Program Files\Altiris\Altiris Agent\installSMPlugin.txt" goto :end

net use u: "\\SMP-W2K8-01.EPM.LOCAL\NSCap\Bin\Win64\X64\Software Management\Plugin"

msiexec.exe /q  /i "u:\SoftwareManagementSolution_Plugin_x64.msi"

TIMEOUT 30

REM Cleanup; Timestamp reinstall (for future check) and un map drive share

TIME /T > "C:\Program Files\Altiris\Altiris Agent\installSMPlugin.txt"

net use u: /DELETE

REM End of script

:end

REM comment "pause" if you don't need "Press any key to continue"

pause

 

exit

 

Attachments

installSMPplugin.bat get_app