How do I POST from Powershell using Invoke-RestMethod
问题 As per https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-restmethod?view=powershell-7#example-2--run-a-post-request I am trying to invoke a simple POST method but getting some errors. My instruction is: $uri = "https://localhost:44355/api/job/machine-status"; #$machineName = HOSTNAME.EXE; $machineName = "simPass2"; $body = @{ Name = $machineName Status = "Complete" } Invoke-RestMethod -Method 'Post' -Uri $uri -ContentType 'application/json' -Body $body;