Shubham
Shubham

Reputation: 43

How to download and install JMeter using PowerShell task in Azure DevOps?

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.

Upvotes: 0

Views: 1003

Answers (2)

Snehal
Snehal

Reputation: 1

$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

Upvotes: 0

Dmitri T
Dmitri T

Reputation: 168092

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

Upvotes: 1

Related Questions