can we install application on multiple remote computers using powershell?

Welcome Forums General PowerShell Q&A can we install application on multiple remote computers using powershell?

This topic contains 13 replies, has 7 voices, and was last updated by

 
Participant
2 months, 3 weeks ago.

  • Author
    Posts
  • #159279

    Participant
    Topics: 5
    Replies: 6
    Points: 67
    Rank: Member

    can we install application on multiple remote computers using powershell?

  • #159282

    Senior Moderator
    Topics: 8
    Replies: 1040
    Points: 3,433
    Helping Hand
    Rank: Community Hero

    Yes !

  • #159285

    Participant
    Topics: 5
    Replies: 6
    Points: 67
    Rank: Member

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

  • #159287

    Senior Moderator
    Topics: 8
    Replies: 1040
    Points: 3,433
    Helping Hand
    Rank: Community Hero

    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

  • #159288

    Participant
    Topics: 5
    Replies: 6
    Points: 67
    Rank: Member

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

  • #159290

    Senior Moderator
    Topics: 8
    Replies: 1040
    Points: 3,433
    Helping Hand
    Rank: Community Hero

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

  • #159306

    Participant
    Topics: 5
    Replies: 6
    Points: 67
    Rank: Member
    $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'}
    }
    
    • #162665

      Participant
      Topics: 3
      Replies: 17
      Points: -8
      Rank: Member

      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')
  • #159318

    Participant
    Topics: 20
    Replies: 32
    Points: 160
    Helping Hand
    Rank: Participant

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

    HTH.

    • #162663

      Participant
      Topics: 5
      Replies: 6
      Points: 67
      Rank: Member

      Hi Sankhadip,

       

      thanks for the response..

      if we use invoke-item can we use 'Silent' argument ?

       

    • #162671

      Participant
      Topics: 1
      Replies: 59
      Points: 328
      Helping Hand
      Rank: Contributor

      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
    • #163146

      Participant
      Topics: 5
      Replies: 6
      Points: 67
      Rank: Member

      Hey an0nemus09,

      1. how can i find if the application supports silent installation or not?

       

      2. Invoke-Command -ComputerName $computer -ScriptBlock {Start-Process 'c:\temp\7Zip.exe'} is the command i am using to install 7zip

       

       

  • #159345

    Participant
    Topics: 12
    Replies: 26
    Points: 94
    Rank: Member

    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).

  • #163157

    Participant
    Topics: 1
    Replies: 1528
    Points: 2,581
    Helping Hand
    Rank: Community Hero

    how can i find if the application supports silent installation or not?

    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 "/?".

You must be logged in to reply to this topic.