Have your read up and practiced with the cmdlet and try the examples in the help files to get fully up to speed on it?
# get function / cmdlet details
(Get-Command -Name Invoke-WebRequest).Parameters
Get-help -Name Invoke-WebRequest -Full
Get-help -Name Invoke-WebRequest -Online
Get-help -Name Invoke-WebRequest -Examples
Have you even tried what you are doing with Invoke-WebRequest to see if it is successful or not? What errors did you encounter.
PowerShell uses curl as a alias for Invoke-WebRequest. They of course are not the same thing and thus cannot replicated identically.
The web cmdlets have been improved PSCore (Windows / Linux / OSX) than they are in PSv5x and below. To make sure you do not run into site connection issues, make sure to use ...
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
...in your code. PSCore is designed to run side by side with Windows PowerShell, it does not replace it.
Using the cmdlet
cUrl vs Invoke-WebRequest
$headers = @{
'X-JFrog-Art-Api' = $apiKey
"Content-Type" = "application/json"
"Accept" = "application/json"
}
Invoke-WebRequest -InFile $file -Method Put -Uri "$ARTIFACTORY_HOST/third-party/test/readme.md" -Headers $headers -Verbose
curl -T readme.md "${ARTIFACTORY_HOST}/third-party/test/readme.md " \
-H "X-JFrog-Art-Api: ${apiKey}" \
-H "Content-Type: application/json" \
-H "Accept: application/json"
You can use curl.exe directly in PowerShell as well, if you choose to do so, just as you can with any other external exe.