Reputation: 1
when i try to run this code in windows powershell
$cred = gcloud auth application-default print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://videointelligence.googleapis.com/v1/videos:annotate" | Select-Object -Expand Content
I recieve this error:
The term "Invoke-WebRequest" is not recognized
Upvotes: 0
Views: 1544
Reputation: 244
Invoke-WebRequest was added in powershell 3.0
So your powershell is older. Windows 7 comes with 2.0 if that is your case.
You can update it by installing WMF 5.1: https://learn.microsoft.com/en-us/powershell/scripting/windows-powershell/wmf/setup/install-configure
If you can't update it, you will have to use the Net Framework's class for web requests: https://learn.microsoft.com/en-us/dotnet/api/system.net.webrequest
Upvotes: 1