Powershell Remoting always logs in as anonymous


I need some help in automating deploying some applications on my domain. The deployment process follows this basic flow in a Powers Shell script:

  1. Stop services
  2. Copy out applications
  3. Log into at least 1 remote server and run "\Services\Shipping\ShippingService.exe /deploy"
  4. Start services.

I'd like to cut out step 3 and integrate it in my script. What I've got so far is

$starter = New-PSSession -ComputerName ServerName -Credential:'domain\user' -Authentication Kerberos
Invoke-Command -Session $starter -ScriptBlock {
\Services\Shipping\ShippingService.exe /deploy

This is paired down to just 1 application, but there are actually 5. The problem I have is that these applications use Integrated Security to access a Sql Server database so it fails with "System.Data.SqlClient.SqlException (0x80131904): Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'."

How do I get my remote session to run as the domain\user specified?

asked on Server Fault Mar 31, 2011 by Kleinux

1 Answer


You are running into what is called a "Double Hop" Scenario. You are remoting into one machine and from there, accessing a remote share. This is possible using PowerShell but you have to use CredSSP authentication.

answered on Server Fault Mar 31, 2011 by Andy Schneider

User contributions licensed under CC BY-SA 3.0