Hello, everyone! I recently meet a strange problem about double hop.
I try to run the following PowerShell command
$credential = Get-Credential
$computerName = "frxp02361Dmbssh"
$psdrive1 = @{
Name = "PSDrive1"
PSProvider = "FileSystem"
Root = "\\mbssh01\Tool"
Credential = $credential
}
$psdrive2 = @{
Name = "PSDrive2"
PSProvider = "FileSystem"
Root = "\\dyn\AX"
Credential = $credential
}
$psdrive3 = @{
Name = "PSDrive3"
PSProvider = "FileSystem"
Root = "\\scmlabe3\SCM"
Credential = $credential
}
$psdrive4 = @{
Name = "PSDrive4"
PSProvider = "FileSystem"
Root = "\\codeflow\public"
Credential = $credential
}
Invoke-Command -ComputerName $computerName -ScriptBlock {
New-PSDrive @using:psdrive1
New-PSDrive @using:psdrive2
New-PSDrive @using:psdrive3
New-PSDrive @using:psdrive4
}
Finally, I successfully create new PSDrives of "\\mbssh01\Tool", "\\scmlabe3\SCM", "\\codeflow\public"EXCEPT FOR "\\dyn\AX"
I received the following error:
Name Used (GB) Free (GB) Provider Root CurrentLocatio PSComputerNam
n e
---- --------- --------- -------- ---- -------------- -------------
PSDrive1 \\mbssh01\Tool frxp02361D...
A specified logon session does not exist. It may already have been terminated+ CategoryInfo : InvalidOperation: (PSDrive2:PSDriveInfo) [New-PSDrive], Win32Exception+ FullyQualifiedErrorId : CouldNotMapNetworkDrive,Microsoft.PowerShell.Commands.NewPSDriveCommand+ PSComputerName : frxp02361Dmbssh
PSDrive3 \\scmlabe3\SCM frxp02361D...
PSDrive4 \\codeflow\public frxp02361D...
We can see the command "New-PSDrive @using:psdrive2" failed.
But the other three commands all succeed.
I have tested that I can access the folder "\\dyn\AX" in File Explorer when I login into the remote computer.
Can anyone help me? I will be very grateful!