Invoke-RestMethod : The underlying connection was closed: An unexpected error
occurred on a send.## Heading ##
At \Desktop\T.ps1:27 char:7
+ $CS = Invoke-RestMethod -Method PUT -Uri https://XXXX ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:Htt
pWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe
ll.Commands.InvokeRestMethodCommand
答案 0 :(得分:0)
您的错误在脚本T.ps1行中:27 char:7,它与Invoke-ResMethod cmdlet有关。我将为您提供有关如何使用Invoke-RestMethod的示例。
Invoke-RestMethod -Uri“放置要请求的dns或ip”-方法(POST或Get)
请求Google的工作示例:
Invoke-RestMethod -Uri "https://www.google.com" -Method GET
这必须返回google网页的html代码