通过文本文件中的几个链接需要使用 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
但是需要对多个链接执行此操作。任何建议如何做到这一点?