[PowerShell] Using PowerShell commands to replace ping, telnet, curl in Windows

 

Situation

When creating a clean Windows VM or App Service in Azure cloud, it is often necessary to check the network status or if other service ports are open. Previously, I would use ping, telnet or curl to read the HTML content of other websites. However, they are not installed by default and I would have to install them myself. Then I realized that PowerShell is a tool that is always installed by default. So I found the corresponding commands that can be used, which quickly solved the network connectivity issue for me recently.

If this article is helpful to you, please click on the advertisement to provide me with extra income as it is also a form of encouragement for me.

Command

Commands to replace ping : Test-Connection
 $> Test-Connection  www.google.com










Commands to replace telnet: Test-NetConnection

 $> Test-NetConnection  www.google.com -Port 443











Commands to replace curl: Invoke-WebRequest

"This example only uses the Get method, for information on how to use the Post method, please refer to the official documentation.
 $>  Invoke-WebRequest https://www.google.com 

留言

熱門文章