About credential

This topic contains 11 replies, has 5 voices, and was last updated by  Sam Boutros 7 months, 3 weeks ago.

  • Author
    Posts
  • #67152

    Narinder Verma
    Participant

    i am trying to connect to remote computer named 'shubham' which is out of my domain.I have established a connection and tested it but i am stuck at the credential part what should be inserted in the pop up that comes whose username and password?

  • #67167

    Michael Bender
    Participant

    You should be using the credentials for the remote machine in the pop up.

    • #67222

      Narinder Verma
      Participant

      i am using the credential for the remote machine as following:

      User-name= Administrator
      password = the password used for login in the system

      but i am getting the following error
      PS C:\WINDOWS\system32> Enter-PSSession -ComputerName shubham -Credential administrator
      Enter-PSSession : Connecting to remote server shubham failed with the following error message : Access is denied. For
      more information, see the about_Remote_Troubleshooting Help topic.
      At line:1 char:1
      + Enter-PSSession -ComputerName shubham -Credential administrator
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo : InvalidArgument: (shubham:String) [Enter-PSSession], PSRemotingTransportException
      + FullyQualifiedErrorId : CreateRemoteRunspaceFailed

    • #67249

      MJ
      Participant

      Since it's out of your domain ie. workgroup computer, you have to make sure you tell both remote and management station to trust each other by modifying the trustedhosts file.

      ie. set-item wsman:\localhost\client\trustedhosts or or (* means trust everyone).

      set-item wsman:\localhost\client\trustedhosts 192.168.1.100 -concatenate -force or
      set-item wsman:\localhost\client\trustedhosts * -force (only use this for testing to prove everything is working)

      you can verify by typing:
      (get-item wmsan:\localhost\client\trustedhosts).value

      This needs to be run on both systems (as well as enabling PSRemoting on target).

    • #67225

      Sam Boutros
      Participant
      # First add the remote computer to list of trusted hosts on this management computer
      Set-Item wsman:\localhost\Client\TrustedHosts shubham -Concatenate -Force
      
      $Cred = Get-Credential -UserName 'shubham\administrator'
      Enter-PSSession -ComputerName shubham -Credential $Cred
      

      For more information, please read 'The Secrets of PowerShell Remoting' free ebook by Don Jones.

  • #67290

    Narinder Verma
    Participant

    again i am getting the same error
    PS C:\WINDOWS\system32> Enter-PSSession -ComputerName shubham -Credential administrator
    Enter-PSSession : Connecting to remote server shubham failed with the following error message : Access is denied. For
    more information, see the about_Remote_Troubleshooting Help topic.
    At line:1 char:1
    + Enter-PSSession -ComputerName shubham -Credential administrator
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (shubham:String) [Enter-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : CreateRemoteRunspaceFailed

  • #67426

    MJ
    Participant

    Narinda,
    Can you tell me what you are remoting into (server/workstation)? You state it's on the outside of your domain, ie. a workgroup system. Please understand that remoting is not enabled by default on the deskop OS's. WinRM is enabled on Server 2012R2, however, you have to tell the workgroup server/workstation to "trust" the management system remoting. If you have older systems, you have to enable the remoting (modify trustedhosts file, allow access through firewall, etc). Your "access denied" suggests perhaps some of this criteria has not been met. Domain remoting and workgroup remoting are VERY different animals.

    m

  • #67449

    Narinder Verma
    Participant

    I am trying to connect to workstation(Laptop) running on windows 10 .I have also windows 10
    i have enabled all the prequesites including psremoting,trustedhosts
    i have also tried test wsman -computername shubham it`s running

  • #67450

    Mark Prior
    Participant

    Have you tried

    Username: 'machinename'\administrator

    • #67455

      MJ
      Participant

      I was just going to suggest that! 😀

  • #67456

    Narinder Verma
    Participant

    This error came:
    Enter-PSSession : A positional parameter cannot be found that accepts argument '\administrator'.
    At line:1 char:1
    + Enter-PSSession -ComputerName shubham -Credential 'shubham'\administr ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [Enter-PSSession], ParameterBindingException

    • #67458

      MJ
      Participant

      1. Did you enable the "Administrator" account on the W10 box? It's disabled by default. I know, I know...just checking
      2. $cred=get-credential
      3. enter-pssession -computername shubham -credential $cred
      or enter-pssession -computername -credential $cred

      Cheers!
      m

You must be logged in to reply to this topic.