PowerShell: Check If Port is Open – Test TCP Connection

During troubleshooting of different issues it is often required to check if some TCP port on a remote host is opened and ensure that it is not blocked by a firewall.

The most common tool for this is telnet, but it may not be installed or you may want to be able to copy the output to paste it into a ticket or to send it someone, that is not always possible with telnet.

Also the telnet command is not very handy if you need to check connectivity to multiple hosts/ports, but you can do this easily with a PowerShell.

In Windows, you can test connection to TCP port from the command line using PowerShell and in this note i will show how to do this. (more…)

Windows: Prevent Lock Screen Timeout When Idle

Corporate Windows computers and servers are usually configured to lock the screen after some time of inactivity.

This is especially inconvenient when your remote desktop session keeps disconnecting with “RDP Session Timeout” each time after few minutes of being idle.

In this article i will show how to stop computer from locking and keep the remote desktop session alive without any 3rd party tools and admin privileges, but with just 2 lines in PowerShell. (more…)

Windows: `Watch` Equivalent – CMD & PowerShell

The watch command in Linux is used to execute a command periodically and show the output.

This is extremely useful if you need to track any changes in the output of a repeatedly executed command.

There is no direct equivalent for the watch command in Windows, however the same result can be achieved using the while loop in a Windows PowerShell or the for loops in a Windows command-line prompt (CMD). (more…)

Windows: Zip | Unzip – Command Line

In the past it was not possible to create Zip files and Unzip archives in Windows without installing third-party programs like WinZip and 7-Zip.

But now Windows has a built-in capability to Zip files and folders and Unzip archives from the command line using PowerShell.

Starting from Windows 8 with PowerShell 3.0 and .NET Framework 4.5 installed by default, it is possible to use a kind of zip and unzip commands from the command line. (more…)