I have a PowerShell script that creates a Windows PowerShell session (PSSession) on a remote server via
Enter-PSSession, both servers are not connected to a DOMAIN. This script is called from a program that is running as a service under the local systems account. For some reason, running the PowerShell script as a local systems account causes the
Enter-PSSession to return an error.
For example, when run from a local admin account the following command asks for my password and connects successfully:
Enter-PSSession -ComputerName #### -Credential ####
However, if I run PowerShell using a Local Systems or Network Service account via psexec:
PsExec -i -s powershell.exe PsExec -i -u "NT AUTHORITY\NetworkService" powershell.exe
Then try the command again it asks for my password and simply returns an error message:
Enter-PSSession : Connecting to remote server #### failed with the following error message : WinRM cannot process the request. The following error with errorcode 0x8009030d occurred while using Negotiate authentication: A specified logon session does not exist. It may already have been terminated.
Any idea how I can get the
Enter-PSSession command to work under a local systems account?