Scripts (PowerShell)

Connecting to a remote server failed and WinRM cannot process the request: Error code 0x8009030e occurred while using Kerberos authentication, and a specified logon session does not exist

I have put together three similar error types I simulated in my Test laboratory. When you are prompted with the following error when using the invoke command, the following solutions and explanation below will help you resolve this issue. Here are some interesting guides: How to request a certificate signing request in Windows using Microsoft Management Console, how to troubleshoot and fix Windows Admin Center that cannot be reached, how to configure servers for remote access, and how to Test Network Connection to the Windows Admin Center (WAC) Gateway.

Error 1: Below is the command run to install and reboot the TechDArchive

Invoke-Command -ComputerName TechDArchive -Script {ipmo PSWindowsUpdate; Get-WUInstall -AcceptAll -AutoReboot | Out-File C:\PSWindowsUpdate.log  } -Verbose

Error 2: When you also run the Enter-PSSession to initiate a connection to the remote server the following error above will also be displayed.

Enter-PSSession -ComputerName TechDArchive

Error 3: The invoke-command used to run the script locally or on remote computers. Once remoting is enabled on remote machines, we can run Invoke-Command as shown below to query the WinRM service. But WE are FACED with an ERROR.

Invoke-Command -ComputerName ServerDC -ScriptBlock {Get-Service winrm}

How do we solve this? | Solution: This error is as a result of my login method as you can see in the error message above.

– This issue was as a result of the host machine (Ansibleserver) from where I was trying to connect to. I was logged into the server as a local user with the Administrators account, whereas the remote machine to which I was trying to connect was running as a domain user. 
– So, when I switched to the domain user account (Chris) on the host machine, Kerberos started working and the issue got resolved.

As you can see below, the invoke-command is working correctly to get the WinRM service.

Also the invoke-command to have windows updates installed is running executing as well.

Below are the tips to ensure you are able to use the invoke-command.
– Ensure PSRemoting is enabled on the remote device.
Ensure WinRM is running on the remote device, To determine this, run WinRM using the following command.
– Ensure the computers (servers) are added in the TrustedHosts. Instead of adding an individual host, use the asterisk to all subsequent hosts

For a similar error where the computer account could not be found, see

I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.

Notify of

Inline Feedbacks
View all comments
Francisco Yepiz
Francisco Yepiz
2 years ago

Thanks for your help!

Would love your thoughts, please comment.x