Automatic Installation

Welcome Forums General PowerShell Q&A Automatic Installation

Viewing 2 reply threads
  • Author
    Posts
    • #229006
      Participant
      Topics: 1
      Replies: 0
      Points: -8
      Rank: Member

      Hello Gurus

       

      I am new to powershell and trying to create an script to install one application with default parameters silently so that manual intervention on GUI can be avoided and when machine is built I can run this script and install application without user intervention.

      below script is not installing application, can someone help me please

       

       

      #applcation1 App1
      $app1name = “App1”
      $app1skip = “no”
      $app1path = “C:\Users\”
      $app1runcommand = “W7W10_Install”
      $app1arguments = “”
      $datetime = Get-Date -format “yyyy.MM.dd-HH.mm.ss”
      $logpath = “C:\Users\$datetime”
      New-Item -Path $logpath -ItemType Directory -ErrorAction SilentlyContinue

      #Transcript Start
      Start-Transcript -Path $logpath

      $startlogtime = Get-Date -format “HH:mm:ss”
      write-host “Script Start Time – $startlogtime”

      #Install Applications
      #Application 1
      if ($app1skip -eq “no”) {
      if ($app1arguments) { #Arguments Variable Populated
      Write-Host Installing Applcation 1 ($app1name)
      $app1 = Start-Process -Wait C:\Users\Desktop\ALM102640\Install\W7W10i_HP_ALM_PATCH_1250_R102_Install C:\Program Files\W7W10_Install -ErrorAction Continue -ArgumentList -WindowStyle Normal

      if ($app1.ExitCode -eq “0”) {
      Write-Host $app1name Installed ok
      } Else {
      Write-host $app1name install exited with code $app1.ExitCode
      }
      }
      }Else { #Argurments Variable Empty
      Write-Host Installing Applcation 1 ($app1name)
      $app1 = Start-Process -Wait -FilePath $app1path$app1runcommand -ErrorAction Continue -WindowStyle Normal
      if ($app1.ExitCode -eq “0”) {
      Write-Host $app1name Installed ok
      } Else {
      Write-host $app1name install exited with code $app1.ExitCode
      }
      }

      #Transcript End
      Stop-Transcript

    • #229070
      Participant
      Topics: 4
      Replies: 2247
      Points: 5,484
      Helping Hand
      Rank: Community MVP

      Man, welcome to Powershell.org. Please take a moment and read the very first post on top of the list of this forum: Read Me Before Posting! You’ll be Glad You Did!.

      When you post code, error messages, sample data or console output format it as code, please.
      In the “Text” view you can use the code tags “PRE“, in the “Visual” view you can use the format template “Preformatted“. You can go back edit your post and fix the formatting – you don’t have to create a new one.
      Thanks in advance.

      Why re-inventing the wheel again and again? There are literally thousands of examples out there and even here in this forum how to install an application silently. There are even complete frameworks dedicated for that purpose. I’d recommend to search for a solution ready to use and spend my time in less common tasks. You could even use this solutions from the web to learn how to do certain things with Powershell.

    • #230407
      Participant
      Topics: 0
      Replies: 14
      Points: 175
      Helping Hand
      Rank: Participant

      Hello tripster97,

      Are you receiving any errors?

Viewing 2 reply threads
  • You must be logged in to reply to this topic.