We have been using a powershell script to ping some of our servers. The script worked fine until recently, Test-Connection $machineName -quiet returns $false even though the machine is fine! (ping $machineName works fine, even Test-Connection $machineName -quiet outside the script works fine). The first thing that came to my mind is to ckeck the user permissions. Is there anything I can do to run more test ?
尝试将测试连接强制转换为布尔值。
if ( [bool](test-connection $hostname -count 1 -quiet) -eq $true) { ...do stuff } else { ..do other stuff}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.