A specified logon session does not exist. It may already have been terminated

Question:

Unable to Map drive to workgroup machine when I’m running the script using the Invoke-command.
I’m connecting to a workgroup machine using the Invoke-command and there I’m trying to map a drive. I’m able to connect to the machine but unable to Map the drive.
The options below I have tried:

I have tried using

Getting Error:

I have tried using

Getting Error:

This is working fine when I’m trying this code directly on the remote machine.

I have also tried enabling CredSSP on both the machine and using Invoke-command. It didn’t help

Answer:

It seems like the “double hop” problem. Try following these links to fix it:
New-PsDrive Remote copy from DFS share errors: A specified logon session does not exist

https://social.technet.microsoft.com/Forums/windowsserver/en-US/a7853ac3-6c48-4615-896a-e306067ab804/net-use-via-powershell-returning-a-specified-logon-session-does-not-exist-it-may-already-have-been?forum=winserversecurity

Source:

A specified logon session does not exist. It may already have been terminated by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply