【发布时间】:2020-07-08 22:40:47
【问题描述】:
需要通过文本文件中的几个链接使用 Invoke-RestMethod 的 PowerShell 脚本获得帮助:
我没有并且适用于单个站点:
$username = 'username'
$password = 'password'
$accept = 'application/xml'
$uri = 'https://example.com/ping/id/31'
$headers = @{
"Accept"=$accept
}
$secpwd = ConvertTo-SecureString $password -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($username, $secpwd)
Invoke-RestMethod -Method Post -Uri $uri -Headers $headers -Credential $credential
但是需要对多个链接执行此操作。 有什么建议如何做到这一点?
【问题讨论】:
标签: powershell invoke-restmethod