Guest User

Untitled

a guest
Aug 30th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. $step = $OctopusParameters['Unpackage step']
  2. $username = $OctopusParameters['Username'];
  3. $password = $OctopusParameters['Password'];
  4. $customExeFilename = $OctopusParameters['Exe filename'];
  5.  
  6. $outputPath = $OctopusParameters["Octopus.Action[$step].Package.CustomInstallationDirectory"]
  7. if(!$outputPath)
  8. {
  9. $outputPath = $OctopusParameters["Octopus.Action[$step].Output.Package.InstallationDirectoryPath"]
  10. }
  11.  
  12. $defaultExeFilename = $OctopusParameters["Octopus.Action[$step].Package.NuGetPackageId"] + ".exe"
  13. $exeFilename = If ($customExeFilename) {$customExeFilename} Else {$defaultExeFilename}
  14. $path = Join-Path $outputPath $exeFilename
  15.  
  16. if(-not (Test-Path $path) )
  17. {
  18. Throw "$path was not found"
  19. }
  20.  
  21. Write-Host "Installing from: $path"
  22. if(!$username)
  23. {
  24. Start-Process $path -ArgumentList "install" -NoNewWindow -Wait | Write-Host
  25. }
  26. else
  27. {
  28. Start-Process $path -ArgumentList "install -username `"$username`" -password `"$password`" " -NoNewWindow -Wait | Write-Host
  29. }
  30. Start-Process $path -ArgumentList "start" -NoNewWindow -Wait | Write-Host
Add Comment
Please, Sign In to add comment