Install MSI application on a remote machine

http://powershell.com/cs/forums/p/6935/11336.aspx

Option 1: Powershell

#Variables

$computername = Get-Content ‘M:\Applications\Powershell\comp list\Test.txt’

$sourcefile = “\\server\Apps\LanSchool 7.7\Windows\Student.msi”

#This section will install the software

foreach ($computer in $computername)

{

$destinationFolder = “\\$computer\C$\download\LanSchool”

#This section will copy the $sourcefile to the $destinationfolder. If the Folder does not exist it will create it.

if (!(Test-Path -path $destinationFolder))

{

New-Item $destinationFolder -Type Directory

}

Copy-Item -Path $sourcefile -Destination $destinationFolder

Invoke-Command -ComputerName $computer -ScriptBlock { & cmd /c “msiexec.exe /i c:\download\LanSchool\Student.msi” /qn ADVANCED_OPTIONS=1 CHANNEL=100}

}

Option 2: I use WMIC to install MSI packages remotely. Since WMI can’t execute and install applications that are located on a fileserver, you have to copy them down first.

I have a batch file I use to do the work: Here is one for example that works well.

 

Set /P Input=Type The Name Of The Computer Or IP Address To Install Symantec Vault:

ECHO Checking To See If Symantec Enterprise Vault Is Already Installed, Please Wait….

wmic /node:%Input% product list | find /i “Symantec Enterprise Vault Outlook Add-In 10.0.3.1090” > nul
IF %ERRORLEVEL% EQU 0 Goto AlreadyInstalled
ECHO Installing Symantec Vault Please Wait….
mkdir \\%Input%\C$\Symantec
copy “\\Fileserver\Share\Symantec_Enterprise_Vault_10\10.0.3\Outlook Add-In\Symantec Enterprise Vault Outlook Add-in.msi” “\\%input%\C$\Symantec\”
wmic /NODE:%input% product call install true,”” , “C:\Symantec\Symantec Enterprise Vault Outlook Add-in.msi”
del “\\%input%\C$\Symantec\Symantec Enterprise Vault Outlook Add-in.msi”
rmdir “\\%Input%\C$\Symantec”
PAUSE
Goto End
:AlreadyInstalled
ECHO Symantec Enterprise Vault Is Already Installed.
ECHO No Further Action Required…
PAUSE
Goto End
:End
EXIT

 

 

WMI natively installs MSI’s silently so you don’t need to use an /S or /quite, /qn switch. Hope that helps.