I need some help in automating deploying some applications on my domain. The deployment process follows this basic flow in a Powers Shell script:
- Stop services
- Copy out applications
- Log into at least 1 remote server and run "\Services\Shipping\ShippingService.exe /deploy"
- 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?