The summary of ‘PsExec Tutorial: How to Run Commands on Remote Computers’

This summary of the video was created by an AI. It might contain some inaccuracies.

00:00:0000:17:37

The video provides a comprehensive tutorial on using the PSExec command for executing remote commands and processes on other computers, which is particularly useful for tasks such as troubleshooting, gathering information, copying files, and installing software. Key steps include configuring the Windows Firewall to open necessary ports (TCP Port 445 and UDP Port 137) and setting up a Group Policy Object named "PSExec Allow" to manage firewall rules and restrict access to specific IP addresses for enhanced security. The video demonstrates running PSExec commands from the command prompt, resolving firewall-related issues for efficient command execution, and updating Group Policy for proper firewall rule implementation. Practical examples include retrieving network adapter information, executing system and user commands on remote computers, and deleting files remotely, highlighting PSExec’s versatility. The overall theme emphasizes securing PSExec to prevent misuse and the importance of precise firewall configuration to facilitate smooth operations.

00:00:00

In this segment of the video, the presenter demonstrates how to use the PSExec command to execute remote commands and processes on other computers, which is useful for troubleshooting, gathering information, copying files, and installing software. The presenter explains that the Windows Firewall typically blocks this command by default, necessitating the opening of TCP Port 445 and UDP Port 137 on remote computers. They guide through creating a Group Policy to implement this, starting with creating and linking a new Group Policy Object (GPO) named “PSExec Allow” to the computers’ Organizational Unit (OU). Additionally, the video underscores the importance of securing PSExec due to its potential misuse by hackers or viruses, detailing how to secure it using the Windows Firewall and ensuring only authorized computers can execute commands remotely. The steps include setting up a firewall rule under Windows settings to open the necessary ports, focusing first on TCP Port 445.

00:03:00

In this segment of the video, the speaker discusses how to set restrictions on a firewall rule to allow connections only from specific IP addresses, ensuring secure use of PS exec. They set the scope of the rule to include only authorized computers by specifying an IP address (e.g., 192.168.100.10). This process involves creating a new rule for port 137 using UDP, configuring it to allow connections only within a domain profile from the specified IP address or a subnet range. The speaker then mentions downloading PS Tools from a provided link, extracting the tools, and organizing them into a folder named PS Tools, where the PS exec command can be found.

00:06:00

In this part of the video, the speaker explains how to run an executable file using PS tools by placing it in the Windows system path, such as `C:WindowsSystem32`, which allows running the command from any location in the command prompt. Instead, the speaker opts to change directories to where PS tools are downloaded. After navigating to `C:S Tools` in the command prompt and listing the directory contents, the speaker demonstrates running the `PSExec` command with the appropriate syntax. However, the command is initially blocked by firewall rules.

To resolve this, the speaker goes to the remote computer (pc1), performs a Group Policy update (GP update) to pull down the correct firewall rules, and verifies that rules for port 445 and 137 have been added to allow remote connections from a specific IP address. Returning to the original computer, the speaker runs `PSExec` again to execute a hostname lookup on the remote pc1. Despite running, the command is noted to execute very slowly due to another firewall-related issue that needs further adjustment.

00:09:00

In this part of the video, the narrator discusses executing a command on a remote computer using PSExec and highlights an issue with the firewall that makes the command run slowly. To solve this, they add a new rule for Remote Service Management in the firewall to allow faster execution. After setting up this rule and running a GP update, the PSExec command runs almost instantly. The narrator then provides instructions on how to download and set up PSTools, and demonstrates running the PSExec command on multiple hostnames to show the enhanced performance and functionality.

00:12:00

In this part of the video, the speaker demonstrates how to retrieve network adapter information from two computers using the `ipconfig` command. The information returned includes IP addresses for both PC1 and SRP-VM1. Additionally, the speaker explains the use of PS exec to open a command prompt session on a remote computer, allowing various commands like `whoami` and `systeminfo` to be executed. These commands help in troubleshooting by providing details such as logged-in users, OS version, hostname, and other system information directly from the remote computer.

00:15:00

In this part of the video, the presenter demonstrates how to delete a file (‘passwords.txt’) on a remote computer using the PSExec tool. The screen shows the remote computer on the left and the local computer on the right. The presenter uses the command prompt to execute the delete command, initially encountering a mistake with the file name but then successfully deleting the file. The presenter points out that PSExec works by copying an executable to the remote computer, which deletes itself upon exiting the command prompt. They advise securing PSExec with a firewall or other security controls to prevent potential issues. The presenter mentions that PSExec is versatile and easy to use, capable of running various commands on remote computers, including passing credentials, killing processes, installing software, and starting computers.

Scroll to Top