Starting a remote session on localhost

Tagged: 

This topic contains 8 replies, has 3 voices, and was last updated by Profile photo of Ben Ben 2 weeks, 5 days ago.

  • Author
    Posts
  • #71950
    Profile photo of Ben
    Ben
    Participant

    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
    Profile photo of Narinder Verma
    Narinder Verma
    Participant

    did you add the remote machine to trusted list??

    • #72023
      Profile photo of Ben
      Ben
      Participant

      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
      Profile photo of Chris
      Chris
      Participant

      Hi Ben,

      Have you tried

       New-PSSession localhost 

      It should then list the session if successful?

    • #72112
      Profile photo of Ben
      Ben
      Participant

      I get the same type of error message:

      https://ibb.co/dn4uAv

  • #72167
    Profile photo of Chris
    Chris
    Participant

    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
    Profile photo of Chris
    Chris
    Participant

    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"}' 

You must be logged in to reply to this topic.