Solved

Remote install of MSI file

Posted on 2016-10-17
4
41 Views
Last Modified: 2016-10-18
I have a custome logmein MSI file i want to execute remotely on a machine, is there a simple way to do this via powershell?
0
Comment
Question by:leadtheway
  • 2
4 Comments
 
LVL 28

Accepted Solution

by:
serialband earned 250 total points
ID: 41847589
I've always just used psexec to call msiexec do that.

I haven't tried through powershell, but others have written up scripts and asked for help.  Maybe those are good starting points.  https://social.technet.microsoft.com/Forums/windowsserver/en-US/297a0c86-be56-4115-bbd5-21a986695f03/powershell-remote-msi-installation?forum=winserverpowershell
https://powershell.org/forums/topic/install-software-on-multiple-remote-servers/
0
 
LVL 6

Assisted Solution

by:Niten Kumar
Niten Kumar earned 250 total points
ID: 41847818
Try using the following example:

$command =  "msiexec.exe /i C:\Avamar\AvamarClient-windows-x86_64-7.0.102-47.msi"
$scriptblock = [Scriptblock]::Create($command)
Invoke-Command -ComputerName $computer -ScriptBlock $scriptblock
0
 
LVL 6

Expert Comment

by:Niten Kumar
ID: 41847821
Also using psexec.exe example below.  Setup your user's ip addresses on clients.txt file.

cls
$computername = Get-Content 'C:\Setup\clients.txt'
$sourcefile = "C:\Setup\MySyncSvcSetup.msi"
$serviceName = "MySyncWinSvc"
$adminUserName = "username"
$adminPassword = "password@123"
#This section will install the software
foreach ($computer in $computername)
{
    #First uninstall the existing service, if any
    C:\PSTools\psexec.exe \\$computer -s -u $adminUserName -p $adminPassword msiexec.exe /x C:\SetupFiles\MySyncSvcSetup.msi /qb
    Write-Host "Uninstalling Service"
    $destinationFolder = "\\$computer\C$\SetupFiles"
    #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
    Write-Host "Files Copied Successfully"
    C:\PSTools\psexec.exe \\$computer -s -u $adminUserName -p $adminPassword msiexec.exe /i C:\SetupFiles\MySyncSvcSetup.msi /qb /l* out.txt
    Write-Host "Installed Successfully"
    C:\PSTools\psexec.exe \\$computer -s -u $adminUserName -p $adminPassword sc.exe start $serviceName
    Write-Host "Starting the Service"
}
0
 
LVL 1

Author Comment

by:leadtheway
ID: 41848151
and i can run this on my machine?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Resolve DNS query failed errors for Exchange
This article will help you understand what HashTables are and how to use them in PowerShell.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now