我有脚本:
$servers = "server01", "s02", "s03"
foreach ($server in $servers) {
$server = (New-Object System.Net.NetworkInformation.Ping).send($servers)
if ($server.Status -eq "Success") {
Write-Host "$server is OK"
}
}
错误信息:
An exception occured during a Ping request.
我需要 ping $servers 数组中的每个服务器并显示状态。我认为,该 Foreach 语句未正确使用,但我无法找出问题所在。感谢您的意见