Mount DFS SMB share in remote PS session fails

SimonHrovatin-5821 0 Reputation points

I'm connecting with PowerShell from my computer to a remote computer ( and trying to mount a DFS share there (\\dfs1\share1). It doesn't work correctly - I get error "A specified logon session does not exist. It may already have been terminated".
The root cause seems to be the combination of DFS share and remote PS session, because mounting a basic non-DFS share through PS remote session works fine. Also, mounting the DFS share directly on the computer (without PsSession) works fine.
I tested on different Windows versions but it behaves the same way.

Does anyone have any solution or ideas to solve this issue?

Below are the steps that I used to reproduce the problem. I also tried capturing network packets for analysis.

  1. From my computer connect to a remote computer
$hostRemote = New-PsSession -Computername -Credential mydomain\administrator
Enter-PsSession $hostRemote
  1. (optional) Start packet capture
pktmon filter add -t TCP
pktmon start --capture --pkt-size 3072 --file-name C:\tcpdump.etl
  1. Mount the network share (it fails with error "A specified logon session does not exist. It may already have been terminated")
New-PsDrive -PsProvider 'FileSystem' -Scope 'Global' -Persist -Name E -Root \\\dfs1\share1 -Credential mydomain\administrator
  1. (optional) Stop capture and convert etl to pcap file (for viewing in wireshark)
pktmon stop
pktmon etl2pcap C:\tcpdump.etl -o C:\tcpdump.pcap
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
692 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MotoX80 25,651 Reputation points

    User's image

    You cannot use mydomain\administrator, you have to pass a credential object.

    I would also think that with DFS you would need to use the domain name and not an IP address.