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 has 13 replies, 7 voices, and was last updated 1 year ago by
    Participant
    .
Viewing 9 reply threads
  • Author
    Posts
    • #159279
      Participant
      Topics: 6
      Replies: 6
      Points: 78
      Rank: Member

      can we install application on multiple remote computers using powershell?

    • #159282
      Senior Moderator
      Topics: 9
      Replies: 1241
      Points: 4,466
      Helping Hand
      Rank: Community Hero

      Yes !

    • #159285
      Participant
      Topics: 6
      Replies: 6
      Points: 78
      Rank: Member

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

    • #159287
      Senior Moderator
      Topics: 9
      Replies: 1241
      Points: 4,466
      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: 6
      Replies: 6
      Points: 78
      Rank: Member

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

    • #159290
      Senior Moderator
      Topics: 9
      Replies: 1241
      Points: 4,466
      Helping Hand
      Rank: Community Hero

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

    • #159306
      Participant
      Topics: 6
      Replies: 6
      Points: 78
      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: 23
      Replies: 48
      Points: 285
      Helping Hand
      Rank: Contributor

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

      HTH.

      • #162663
        Participant
        Topics: 6
        Replies: 6
        Points: 78
        Rank: Member

        Hi Sankhadip,

         

        thanks for the response..

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

         

      • #162671
        Participant
        Topics: 1
        Replies: 64
        Points: 363
        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: 6
        Replies: 6
        Points: 78
        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: 99
      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: 5
      Replies: 2376
      Points: 6,030
      Helping Hand
      Rank: Community MVP

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

Viewing 9 reply threads
  • The topic ‘can we install application on multiple remote computers using powershell?’ is closed to new replies.