2010-08-12 56 views
6

是否有使用PowerShell ping機器列表的快速功能?PowerShell的快速​​ping功能

我知道我可以使用測試連接:

Test-Connection -Count 1 -ComputerName (gc .\comps.txt) -ea silentlycontinue 

但這似乎十分緩慢(我假設,因爲它使用的Win32_PingStatus)。

更好的例子是如何將它作爲後臺作業來加速它將是最有用的。

+0

您對PowerShell的V1或V2(其它有用的腳本和別名之間)? (v2橫幅版權日期爲2009年) – x0n 2010-08-13 00:24:25

+0

我在v2上。我認爲測試連接只在v2中? – fenster 2010-08-13 14:24:37

+1

http://codereview.stackexchange.com/questions/97726/powershell-to-quickly-ping-a-number-of-machines – JohnLBevan 2015-09-10 10:13:45

回答

5

PowerShell的社區擴展包括快速平

http://pscx.codeplex.com/

+0

這是我使用的一個。它允許您指定超時值。 – 2010-08-12 20:24:09

+0

的命令是: 平主機[-HostName] [-Count] ] [-NoDnsResolution] [-Quiet] [-buffersize] ] [-Timeout] ] [TTL電] ] [[-AllAddresses]] [[ - Asynchronous]] [] – S0me0ne 2012-10-09 13:49:55

+0

這顯然是PowerShell 1.0的解決方案。 'Ping-host' cmdlet現在已被作者棄用,並被'test-connection'替代。如果您經歷過安裝PSCX的麻煩,每次使用時都會出現錯誤。 – YetAnotherRandomUser 2017-07-28 11:25:26