Enter-PSSession Error for my own vm

This topic contains 2 replies, has 3 voices, and was last updated by Profile photo of Stein Petersen Stein Petersen 2 years, 1 month ago.

  • Author
    Posts
  • #20418
    Profile photo of Ritwik Chatterjee
    Ritwik Chatterjee
    Participant

    Hi,

    I am new to powershell and new to the forum.

    I am trying to remote into one vm from another vm and I am getting the following error:

    [i]Enter-PSSession : Connecting to remote server ritwikdevbox4 failed with the following error message : WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet. For more information, see the about_Remote_Troubleshooting Help topic.
    At line:1 char:1
    + Enter-PSSession -ComputerName ritwikdevbox4
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: [ritwikdevbox4:String] [Enter-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : CreateRemoteRunspaceFailed[/i]

    Here are the steps I have taken prior to this:

    1. Setup a new vm on Azure with a Windows Server 2012 R2 image called ritwikdevbox2
    2. Setup a second vm on Azure with a Windows Server 2012 R2 image called ritwikdevbox4. It is in the same domain as ritwikdevbox2

    Here are the nslookup output on ritwikdevbox2 prompt:

    [b]PS [ritwikdevbox2] > nslookup ritwikdevbox2[/b]
    [i]Server: UnKnown
    Address: 168.63.129.16

    Name: ritwikdevbox2.ritwikdevbox2.d2.internal.cloudapp.net
    Address: 1xx.16.0.4[/i]

    [b]PS [ritwikdevbox2] > nslookup ritwikdevbox4[/b]
    [i]Server: UnKnown
    Address: 168.63.129.16

    Non-authoritative answer:
    Name: ritwikdevbox4.ritwikdevbox2.d2.internal.cloudapp.net
    Address: 1xx.16.0.6[/i]

    3. Ran Enter-PSSession from ritwikdevbox2

    [b]PS [ritwikdevbox2] > Enter-PSSession -ComputerName ritwikdevbox4[/b]

    Error received
    [i]Enter-PSSession : Connecting to remote server ritwikdevbox4 failed with the following error message : The WinRM client cannot process the request. If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain, then HTTPS transport must be used or the destination machine must be added to the TrustedHosts configuration setting. Use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. You can get more information about that by running the following command: winrm help config. For
    more information, see the about_Remote_Troubleshooting Help topic.
    At line:1 char:1
    + Enter-PSSession -ComputerName ritwikdevbox4
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: [ritwikdevbox4:String] [Enter-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : CreateRemoteRunspaceFailed[/i]

    Issue fixed by:
    [b]PS [ritwikdevbox2] > Set-Item wsman:localhost\client\trustedhosts -Value ritwikdevbox4[/b]

    Again trying Enter-PSSession
    [b]PS C:\Users\ritwikadmin> Enter-PSSession -ComputerName ritwikdevbox4[/b]

    Here is the error I receive:

    [i]Enter-PSSession : Connecting to remote server ritwikdevbox4 failed with the following error message : WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet. For more information, see the about_Remote_Troubleshooting Help topic.
    At line:1 char:1
    + Enter-PSSession -ComputerName ritwikdevbox4
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: [ritwikdevbox4:String] [Enter-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : CreateRemoteRunspaceFailed
    [/i]

    I realize that I probably am making a very silly mistake. I probably need to open up a port or something of that sort. But I have spent more than a few hours trying to move beyond this and I cannot. Please help.

    Please help. Please do not assume anything. I am new to windows technology. So I might be missing the smallest bit of things.

    Thanks in advance.

    Ritwik

  • #20419
    Profile photo of Ondrej Zilinec
    Ondrej Zilinec
    Participant

    Look how it's [url="http://www.cievo.sk/2014/03/21/remote-powershell-in-domain-environment/"]set in domain[/url], maybe you fill get idea how to setup in your environment.

  • #20427
    Profile photo of Stein Petersen
    Stein Petersen
    Participant

    Can you run

    Get-NetConnectionProfile

    on ritwikdevbox4.

    If it responds with public, set it to private or domain if you can, and try connecting to it again.

You must be logged in to reply to this topic.