can we install application on multiple remote computers using powershell?

can we install application on multiple remote computers using powershell?

Yes !

Can you share the forum related to this topic or the script if you have?

The basic principle of PowerShell remoting is , what ever runs locally(almost everything, with few exceptions) will run remotely.

If you have a code that installs your application by running the it locally, put that inside scriptblock and pass it to Invoke-Command. I suggest you to read the documentation of Invoke-Command.

Get-Help Invoke-Command -Online

I have tried… But it only copies the file to remote machine but its not installing.

Please post the code/sample you have. It’ll help anyone trying to help you.

$computername = Get-Content computers.txt
$sourcefile = "\\DC16\Share\7Zip.exe"

foreach ($computer in $computername)
{
$destinationFolder = "\\$computer\C$\Temp"

if (!(Test-Path -path $destinationFolder))
{
New-Item $destinationFolder -Type Directory
}
Copy-Item -Path $sourcefile -Destination $destinationFolder
Invoke-Command -ComputerName $computer -ScriptBlock {Start-Process 'c:\temp\7Zip.exe'}
}

I didn’t test the script, but by reading it seems okay. Please use invoke-item instead of Start-process.

HTH.

You also want to make sure the program doesn’t try to install interactively. If any windows try to pop up on the remote machine that you need to click will prevent the install from finishing. Use whatever switch will allow it to run silently (ex. /silent, /s).

Hi Sankhadip,

 

thanks for the response…

if we use invoke-item can we use ‘Silent’ argument ?

 

John Steele is right on, but for 7zip, it’s a capital “S”: c:\temp\7Zip.exe /S

Also, since this will be running as your user account on each of those computers, make sure you’re a local admin, and there’s no need to copy the .exe over first.

However, with Start-Process, there’s a parameter for passing arguments:

Start-Process -FilePath 'C:\temp\7zip.exe' -ArgumentList @('/S')

Using powershell (or really any command line tool) is up to the binary package if it supports a silent/unattended installation. In the windows world not everything does (but it IS a lot better than it used to be).

You’re facing multiple questions:

  1. Does 7zip suppport an unattended/silent install?
  2. If it does, what command line settings are you going to need to set?
  3. The best way to feed them into powershell.

Here’s one I created for zulu java:

$jv=(get-childitem zulu*.msi).name
$jInstall=join-path $drive -childpath "\tools\java"
$jargList="APPLICATIONROOTDIRECTORY=$jInstall /qn"
start-process $jv -ArgumentList $jargList -wait

Hey an0nemus09,

  1. how can i find if the application supports silent installation or not?
 
  1. Invoke-Command -ComputerName $computer -ScriptBlock {Start-Process ‘c:\temp\7Zip.exe’} is the command i am using to install 7zip

 

 

[quote quote=163146]
how can i find if the application supports silent installation or not? [/quote]

You are allowed to do your own research. This forum is about scripting with Powershell. Please use your favorite internet search engine to find some information about a particular topic before you start to ask other people in forums about the same topic. You should have basic knowledge at first.

To answer your question - if you’re unsure you search the internet for the name of the application together with the words “silent installation”. Usually it works out of the box for almost all MSI-Installation packages and all Setup.exe. A suitable way to figure that out is to try to run the executable with the command line option “/?”.