203k views
2 votes
You deploy a new VM with default settings to a resource group named RG1. You validate that you can connect to it by using Remote Desktop Connection. However, when you attempt to connect to it through PowerShell remoting, the connection fails. You need to ensure that you can manage the VM by using PowerShell remoting. What should you do? Select one.

1 Answer

2 votes

Final answer:

To enable PowerShell remoting on the VM, run Enable-PSRemoting on the VM, ensure the Windows Firewall allows traffic on the necessary ports, and configure the NSG for the VM to allow inbound traffic on those ports.

Step-by-step explanation:

To manage the VM by using PowerShell remoting, you need to ensure that PowerShell remoting is enabled on the VM and the appropriate network security group (NSG) rules are in place to allow the remote connection. By default, PowerShell remoting uses the WS-Management protocol, which listens on port 5985 for HTTP and port 5986 for HTTPS.

Here's what you should do to enable PowerShell remoting on the VM:

  1. Make sure that the VM is configured to allow PowerShell remoting. This typically involves running the Enable-PSRemoting cmdlet on the VM.
  2. Verify that the Windows Firewall on the VM allows traffic on the ports used by PowerShell remoting (particularly port 5985 for HTTP).
  3. Edit the network security group (NSG) associated with the VM in RG1 to create an inbound security rule that allows TCP traffic on port 5985.
  4. If your organization's policy requires encrypted communication, you might need to configure PowerShell remoting to use HTTPS and open port 5986 instead.

After these steps are performed, you should be able to establish a PowerShell remoting session with the VM in RG1.

User Ossmalpha
by
8.5k points