执行Powershell脚本时出现错误

时间:2019-05-10 21:45:13

标签: powershell

Invoke-RestMethod : The remote server returned an error: (401) Unauthorized.
At C:\Users\C046032\Documents\Runschedule.ps1:51 char:16
+ ... $response = Invoke-RestMethod -Uri ${protocol}://$server/api/$api_ver ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

Invoke-RestMethod : The remote server returned an error: (401) Unauthorized.
At C:\Users\C046032\Documents\Runschedule.ps1:23 char:15
+ ... $response = Invoke-RestMethod -Uri ${protocol}://$server/api/$api_ver ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

Invoke-RestMethod : The remote server returned an error: (404) Not Found.
At C:\Users\C046032\Documents\Runschedule.ps1:75 char:17
+ ... $response = Invoke-RestMethod -Uri ${protocol}://$server/api/$api_ver ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

Invoke-RestMethod : The remote server returned an error: (401) Unauthorized.
At C:\Users\C046032\Documents\Runschedule.ps1:91 char:15
+ ... $response = Invoke-RestMethod -Uri ${protocol}://$server/api/$api_ver ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

0 个答案:

没有答案