Orchestrator API のUiPath.Server.Configuration.OData.UploadPackage を powershell で行いたい

Orchestrator API のUiPath.Server.Configuration.OData.UploadPackage を powershell で行いたいです
以下の様にしているのですが、エラーとなります。恐らくファイル指定の方法か、header 指定が誤っているのかと思うのですがご存知の方いらっしゃいますでしょうか

poweshell
$headers = @{“Authorization”=“Bearer $authKey”}
$contentType = “multipart/form-data”
$resCreatePackage = Invoke-RestMethod -Uri $uriUpLoadPackage -Method Post -ContentType $contentType -Headers $headers -Infile $packagePath

$haaders は

エラー
ERROR: {“message”:“The package file is required.”,“errorCode”:1677,“resourceIds”:null}

自己解決しました

swaggerで UploadPackage を行う時に firefox のデバッガでリクエストを取得し、それをpowershellで header と body を再現したところアップロードできました
powershell 6.1 なら multipart/form-data に対応しているっぽいので、もっと簡単に出来るのかもしれません

do you have any resolution for this? I am also getting the same error

$uriUpLoadPackage = "$uriOrch/odata/Processes/UiPath.Server.Configuration.OData.UploadPackage"
$fileName = [System.IO.Path]::GetFileName($packagePath)
$UTF8woBOM = New-Object "System.Text.UTF8Encoding" -ArgumentList @($false)
$boundary = '---------------------------398947544637'
$tempFile = './tempfile'
$sw = New-Object System.IO.StreamWriter($tempFile, $false, $UTF8woBOM)
$sw.Write("--$boundary`nContent-Disposition: form-data; name=`"file`"; filename=`"$fileName`"`nContent-Type: application/octet-stream`n`n")
$sw.Close()
$fs = New-Object System.IO.FileStream($tempFile, [System.IO.FileMode]::Append)
$bw = New-Object System.IO.BinaryWriter($fs)
$fileBinary = [System.IO.File]::ReadAllBytes($packagePath)
$bw.Write($fileBinary)
$bw.Close()
$sw = New-Object System.IO.StreamWriter($tempFile, $true, $UTF8woBOM)
$sw.Write("`n--$boundary--`n")
$sw.Close()
$resCreatePackage = Invoke-RestMethod -Uri $uriUpLoadPackage -Method Post -Headers $headers -ContentType "multipart/form-data; boundary=$boundary" -InFile $tempFile