0

In the Azure DevOps pipeline I am doing POC on instead of downloading the JMeter extension from Marketplace, I am trying to download it using PowerShell/Command line task.

I am not getting the exact command or approach that I can use to download Jmeterpowe using PowerShell.

Shubham
  • 43
  • 3

2 Answers2

1

I think you're looking for Invoke-WebRequest cmdlet

  • To download JMeter:

     Invoke-WebRequest -Uri https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-5.4.1.zip -OutFile c:\temp\jmeter.zip
    
  • To unpack JMeter you can use Expand-Archive:

     Expand-Archive -LiteralPath 'c:\temp\jmeter.zip' -DestinationPath c:\temp
    
  • To launch JMeter:

     C:\temp\apache-jmeter-5.4.1\bin\jmeter.bat
    

Remember that you will need to have Java SDK of version 8+ in order to be able to run JMeter

More information: Get Started With JMeter: Installation & Tests

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
0
$Url = 'https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-5.4.3.zip'
$ZipFile = 'C:\Users\snehal.khot\Documents\JmeterAndJenkins\Jmeter'+$(Split-Path -Path $Url -Leaf)
$Destination= 'C:\Users\snehal.khot\Documents\JmeterAndJenkins\jmeter'
Invoke-WebRequest -Uri $Url -OutFile $ZipFile
$ExtractShell = New-Object -ComObject Shell.Application
$Files = $ExtractShell.Namespace($ZipFile).Items()`
$ExtractShell.NameSpace($Destination).CopyHere($Files)
Start-Process $Destination
Adriaan
  • 17,741
  • 7
  • 42
  • 75
Snehal
  • 1
  • 1
  • 1
    Welcome to Stack Overflow! Please read [answer] and [edit] your question to contain an explanation as to why this code would actually solve the problem at hand. Always remember that you're not only solving the problem, but are also educating the OP and any future readers of this post. – Adriaan Jun 17 '22 at 11:42