Starting a remote session on localhost

Welcome Forums General PowerShell Q&A Starting a remote session on localhost

This topic contains 8 replies, has 3 voices, and was last updated by

Ben
 
Participant
1 year, 6 months ago.

  • Author
    Posts
  • #71950
    Ben

    Participant
    Points: 0
    Rank: Member

    Hi, I'm very new to PowerShell and I've been following the "Learn PowerShell in a Month of Lunches" book, but got stuck on trying to start a remote session on my own computer or localhost. When I put in:

    Enter-PSSession -computername localhost

    I get this error:

    https://ibb.co/b0invv

  • #71992

    Participant
    Points: 0
    Rank: Member

    did you add the remote machine to trusted list??

    • #72023
      Ben

      Participant
      Points: 0
      Rank: Member

      Probably not, but how would I check that? and do you have to always add the target computer to the trusted list for remoting?

      Shouldn't your own computer or localhost be on that trusted list already?

    • #72097

      Participant
      Points: 0
      Rank: Member

      Hi Ben,

      Have you tried

       New-PSSession localhost 

      It should then list the session if successful?

    • #72112
      Ben

      Participant
      Points: 0
      Rank: Member

      I get the same type of error message:

      https://ibb.co/dn4uAv

  • #72167

    Participant
    Points: 0
    Rank: Member

    Is the Windows Remote Management service running on the local machine? If so, try restarting it and see if the error persists, more things to make sure, are you admin on local machine etc.

  • #72269

    Participant
    Points: 0
    Rank: Member

    Hi Ben,

    Ok, try adding it to the list of trusted hosts, although i'd be unsure as to why it thinks a localhost is an untrusted domain,

    anyway, try using this command to add your machine to the trusted host list. Let me know how it behaves.

     winrm s winrm/config/client '@{TrustedHosts="localhost"}' 

The topic ‘Starting a remote session on localhost’ is closed to new replies.