title: PS Remote session without passing credentials
body: <p>I want to start a <code>New-PSSession</code> without having to pass credentials in a script. I know you can get the password from a file or have it hardcoded in the script and then convert it to a secure string to start the session. However, I want to start the session using the current user's credentials.</p>
  
  <p>The machine I am trying to remote to is in the same domain.</p>
  
  <p>I tried:</p>
  
  <pre><code>Enter-PSSession -ComputerName machineInDomain
  </code></pre>
  
  <blockquote>
    <p>Enter-PSSession : Connecting to remote server failed with the
    following error message : WinRM cannot process the request. The
    following error occured while using Kerberos authentication: The
    network path was not found.  Possible causes are:<br>
    -The user name or
    password specified are invalid.<br>
    -Kerberos is used when no
    authentication method and no user name are specified.<br>
    -Kerberos
    accepts domain user names, but not local user names.<br>
    -The Service
    Principal Name (SPN) for the remote computer name and port does not
    exist.   -The client and remote computers are in different domains and
    there is no trust between the two domains.  After checking for the
    above issues, try the following:<br>
    -Check the Event Viewer for events
    related to authentication.<br>
    -Change the authentication method; add
    the destination computer to the WinRM TrustedHosts configuration
    setting or us e HTTPS transport.  Note that computers in the
    TrustedHosts list might not be authenticated.<br>
    -For more information
    about WinRM configuration, run the following command: winrm help
    config. For more information,  see the about_Remote_Troubleshooting
    Help topic. </p>
    
    <p>At line:1 char:16
    + Enter-PSSession &lt;&lt;&lt;&lt;  -ComputerName machineInDomain
        + CategoryInfo          : InvalidArgument: (machineInDomain:String) [Enter-PSSession],
    PSRemotingTransportException
        + FullyQualifiedErrorId : CreateRemoteRunspaceFailed</p>
  </blockquote>
  
  <p>Kerberos should pass the current user's credentials with trust if in the same domain.</p>
  
  <pre><code>Enter-PSSession -ComputerName $RemoteHost -Authentication Kerberos
  </code></pre>
  
  <blockquote>
    <p>Enter-PSSession : Connecting to remote server  failed with the following error message
    : WinRM cannot process the request. The following error occurred while using Kerberos authentication: The computer
    $RemoteHost is unknown to Kerberos. Verify that the computer exists on the network, that the name
    provided is spelled correctly, and that the Kerberos configuration for accessing the computer is correct. The most
    common Kerberos configuration issue is that an SPN with the format HTTP/$RemoteHost is not
    configured for the target. If Kerberos is not required, specify the Negotiate authentication mechanism and resubmit
    the operation. For more information, see the about_Remote_Troubleshooting Help topic.</p>
  
  <pre><code>At line:1 char:1
  + Enter-PSSession -ComputerName $RemoteHost -Authentication Ke ...
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: ($RemoteHost) [Enter-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : CreateRemoteRunspaceFailed
  </code></pre>
  </blockquote>
  
  <p>It seems to be a domain problem.</p>