Need to connect to remote PC with Powershell
Hi, everyone! Is it possible to connect to remote computerwith Powershell? Can you tell me how to start a remote Powershell session? Please accept my heartfelt gratitude in advance!
We know that there are a variety of methods for remotely accessing a PC, including Group Policy and utilizing the "mstsc" command in the dialog box. There is, in fact, another method for establishing a remote connection. That's Powershell in action.
How do I connect to a remote computer using Powershell?
By using Powershell to connect to remote computer, the prerequisite is that both of the workstations are on the same domain, and the account of the local PC has admin rights on the server. Here are 2 ways that can help you connect to remote computer with Powershell. The point that needs to pay attention that the RDP of the remote PC must have been enabled before the remote connections.
Way 1. Running Powershell to connect directly
In this way, we can connect to the remote server directly with little effort.
Step 1. Right-click on the Start menu and then choose Windows Powershell (Admin).
Step 2. Type mstsc /v:(IP address of the remote PC):3389 and then press Enter, such as "mstsc /v:192.168.0.63:3389".
Step 3. Now the connection will be established.
Note: You can also use the command line mstsc /v: SERVERNAME to connect to the remote PC, such as "mstsc /v:192.168.0.45" After that, remote Powershell session is established.
Way 2. Run Powershell to open RDP
Another way to connect to remote computer is running another command line in Powershell to open Remote Desktop and then input the IP address of the remote PC.
Step 1. Right-click on the Start menu and then choose windows Powershell (Admin).
Step 2. Enter the following command and then the Remote Desktop will appear.
Start-Process "$env:windir\system32\mstsc.exe" -ArgumentList "/v:$machinename", such as Start-Process "$env:windir\system32\mstsc.exe" -ArgumentList "/v:$administrator"
Step 3. Enter the IP address of the remote PC and then select “Connect”. After inputting the credentials, the connection will be successful.
AnyViewer: realize easy connections to remote PC
After the demonstration, you must know how to connect to remote computer with Powershell. However, we have to admit that in the process of connecting, we may meet with various RDP errors such as “Access is denied”, error code 0x204, and so on. Therefore, we strongly recommend using remote access software-- AnyViewer.
With AnyViewer, you can enjoy easy and fast connections with one click to connect to remote servers and you won’t meet with different errors. Supported by a strong team, AnyViewer is being more and more popular for its flexible connection methods and less limitation. And you can use it on Windows 11/10/8.1/8/7 and Windows Server 2022/2019/2016/2012 R2. Follow me to know more about it.
Before the connection:
- Make sure the network is available
- Download and install AnyViewer
Step 1. Install AnyViewer. Sign up for the AnyViewer account and then log in to this account on the two computers. Once logged in, the PC will be assigned to the account automatically. (If you sign up in the official website, you can log in directly.)
Step 2. After logging in, you can see your interface as the following picture.
Step 4. On the client computer, go to "Device", locate and click the PC that you need to control. And then click "Remote control" to achieve remote connection with one click.
If you need to remotely access a server to give support, you can also try go to the “Connect” tab to realize remote connection by inputting the device ID of the remote PC and then realize remote connections via sending a request control.
Hello there, pal. Do you know how to how to connect to the remote computer with Powershell? If you succeed, you are great. However, if you encounter any problems or errors while using Powershell to connect to the remote PC, don't worry, and believe AnyViewer can help.