powershell 无法 ping 通网址
powershell cannot ping a web address
我 运行 powershell 在 Windows 10 64 位中作为管理员。当我 ping www.powershellgallery.com
时出现错误:
PS C:\WINDOWS\system32> ping www.powershellgallery.com
Pinging psg-prod-eastus.cloudapp.net [40.87.85.101] with 32 bytes of data:
Request timed out.
Ping statistics for 40.87.85.101:
Packets: Sent = 1, Received = 0, Lost = 1 (100% loss),
但是当我 ping 其他网址时,例如 google.com,一切正常。
PS C:\WINDOWS\system32> ping www.google.com
Pinging www.google.com [216.58.213.68] with 32 bytes of data:
Reply from 216.58.213.68: bytes=32 time=15ms TTL=56
Reply from 216.58.213.68: bytes=32 time=14ms TTL=56
Reply from 216.58.213.68: bytes=32 time=13ms TTL=56
Reply from 216.58.213.68: bytes=32 time=13ms TTL=56
Ping statistics for 216.58.213.68:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 13ms, Maximum = 15ms, Average = 13ms
知道发生了什么事吗?
这确实不是 powershell 的问题。事实上,这根本不是问题。 Ping 正在使用 ICMP。它基本上是一条回声消息。公司可以阻止而不允许 ICMP。
所以仅仅因为没有 ping 并不意味着某些东西不工作。
一些网络服务器配置为不响应 ping。正如 ArcSet 上面回复的那样,ping 失败并不意味着网站已关闭。
幸运的是,有一个快速修复方法:Test-NetConnection,它允许您检查特定端口。语法如下(在本例中,针对 HTTPS):
Test-NetConnection powershellgallery.com -Port 443
此外,您还可以添加开关InformationLevel。在这种情况下,响应要短得多(True 或 False),如果您想在脚本中使用它会非常方便。
Test-NetConnection powershellgallery.com -Port 443 -InformationLevel Quiet
干杯。
我 运行 powershell 在 Windows 10 64 位中作为管理员。当我 ping www.powershellgallery.com
时出现错误:
PS C:\WINDOWS\system32> ping www.powershellgallery.com
Pinging psg-prod-eastus.cloudapp.net [40.87.85.101] with 32 bytes of data:
Request timed out.
Ping statistics for 40.87.85.101:
Packets: Sent = 1, Received = 0, Lost = 1 (100% loss),
但是当我 ping 其他网址时,例如 google.com,一切正常。
PS C:\WINDOWS\system32> ping www.google.com
Pinging www.google.com [216.58.213.68] with 32 bytes of data:
Reply from 216.58.213.68: bytes=32 time=15ms TTL=56
Reply from 216.58.213.68: bytes=32 time=14ms TTL=56
Reply from 216.58.213.68: bytes=32 time=13ms TTL=56
Reply from 216.58.213.68: bytes=32 time=13ms TTL=56
Ping statistics for 216.58.213.68:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 13ms, Maximum = 15ms, Average = 13ms
知道发生了什么事吗?
这确实不是 powershell 的问题。事实上,这根本不是问题。 Ping 正在使用 ICMP。它基本上是一条回声消息。公司可以阻止而不允许 ICMP。
所以仅仅因为没有 ping 并不意味着某些东西不工作。
一些网络服务器配置为不响应 ping。正如 ArcSet 上面回复的那样,ping 失败并不意味着网站已关闭。 幸运的是,有一个快速修复方法:Test-NetConnection,它允许您检查特定端口。语法如下(在本例中,针对 HTTPS):
Test-NetConnection powershellgallery.com -Port 443
此外,您还可以添加开关InformationLevel。在这种情况下,响应要短得多(True 或 False),如果您想在脚本中使用它会非常方便。
Test-NetConnection powershellgallery.com -Port 443 -InformationLevel Quiet
干杯。