I'm trying to convert the commands from How to redeploy instance using API in rancher to powershell.
pod_upgrade_body=$(curl -u "token-[use your token here]" \
-s 'https://rancher.mydomain.com/v3/project/c-zqpm5:p-h884r/workloads/deployment:development:api' \
-X GET \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Pragma: no-cache' \
-H 'Cache-Control: no-cache' 2>&1 | sed "s/\"cattle\.io\/timestamp\"\:\"[0-9T:Z-]*\"/\"cattle\.io\/timestamp\":\"$(date -u +"%Y-%m-%dT%H:%M:%SZ")\"/g")
This is my attempt but I can't seem to make it work
Invoke-WebRequest -Method GET -Uri https://rancher... -Header @{Accept = 'application/json'; Authorization = 'Bearer [my-token]'; 'Content-type' = 'application/json'; Pragma = 'no-cache'; 'Cache-Control' = 'no-cache'} |cat %{$_ -replace "s/\`"cattle.io/timestamp\`":\`"[0-9T:Z-]*\`"/\`"cattle.io/timestamp","$(date -u +"%Y-%m-%dT%H:%M:%SZ")\`"/g"}
I'm getting the following error
Get-Content : A positional parameter cannot be found that accepts argument '$_ -replace "s/\`"cattle.io/timestamp\`":\`"[0-9T:Z-]*\`"/\`"cattle.io/timestamp","$(date -u
+"%Y-%m-%dT%H:%M:%SZ")\`"/g"'.