TECHNIG
Gateway for IT Experts and Tech Geeks

How to Set up a PowerShell Remoting Connection

PowerShell Remoting allows you to manage a remote computer from your local computer. You type commands on your local computer, and the changes are made on the remote computer. When you set up a PowerShell Remoting connection, you can execute commands remotely, and the changes will be made on the remote computer. The remote computer is the computer that you want to manage, and your local computer is the computer that you are using to manage the remote computer.

Here are some important points to keep in mind before setting up a PowerShell Remoting connection:

  1. Both the local and remote computers must be in the same domain or workgroup. This is because PowerShell Remoting uses Windows Remote Management (WinRM), which is a feature of Active Directory.
  2. Both computers must have PowerShell installed. PowerShell is a command-line shell and scripting language that is included with Windows.
  3. AD-DS, DHCP, and DNS servers must be configured and running on your network. These servers are used by WinRM to authenticate users and resolve hostnames.
  4. The IP address configuration on both computers must be correct. The remote computer’s IP address must be reachable from the local computer.
  5. The network adapter connection type for all network adapters on both computers must be set to Private. If any of the network adapters are set to Public, you will receive an error when you try to connect to the remote computer.

Create PowerShell Remoting Sessions

Follow the steps below to set up a PowerShell Remoting connection.

  1. Enable Powershell remoting on the remote computer by running the Enable-PSRemoting command.
Enabling PowerShell Remoting
Enabling PowerShell Remoting on the remote computer.
  1. Set up a remote connection by typing the Enter-PSSession -ComputerName [Name of the computer] command in the local computer. The name of the machine that you are connected to will add at the beginning of commands to show that you are running commands on that particular machine.
  1. If you want to create multiple sessions, use the command New-PSSession [Computer Name]. Instead of [Computer Name] use the computer name of your own machine.
Set-up PowerShell Remoting Session.
Create New PowerShell Remoting Session.
  1. To see the list of created PowerShell sessions, type the command Get-PSSessions. As you can see, I have one PowerShell session in the list and it is available for connection.
  1. Type the command Get-Command -Noun PSSession to see the list of PowerShell Remoting session commands.
PowerShell Remoting session commands
List of the PowerShell remoting session commands.

You don’t have to use PowerShell Remoting for commands that have computer name parameters. You can execute commands that have computer name parameters on the target computer without setting up a PowerShell Remoting session.

PowerShell Remoting is much faster than other remoting tools because it uses commands and scripts to manage the target computer. You can create multiple remoting sessions without loading much on the CPU.

Check out this article to know more about PowerShell Remoting.

Leave A Reply

Your email address will not be published.