SimonS
SimonS

Reputation: 1973

Creating a Junction Point on a remote Server (Networkdrive)

I'm trying to create Junction Points in PowerShell. This command on my local Drive works very well:

$Local = New-Item -ItemType Junction -Path C:\install\junction -value C:\cygwin64

This is the same command but for a Network Drive (Remote Server)

$Netwo = New-Item -ItemType Junction -Path I:\TRANSFER\Junction -value I:\somewhere

This command does not throw an error, so the junction point got successfully created

I also tried to do it with UNC-path \\server\share\somewhere and even with the Local Path from the server like D:\Data\somewhere but it still doesn't let me access the Junction I created on the Remote Server.

Does anybody know why?

This is the error screenshot, unfortunately in german, but it basically says "the path is not available"

enter image description here

Upvotes: 1

Views: 2452

Answers (2)

Ryan Bolger
Ryan Bolger

Reputation: 1295

I realize this question has already been asked and answered to the OP's satisfaction. But I'm wondering if there is another interpretation of the question that was missed. Specifically, I don't think he was asking to make a junction whose target is a remote share.

Instead, I think he was trying to create a normal local junction on a remote server which is entirely doable with the use of typical powershell remoting type commands like this:

# using cmd's mklink
Invoke-Command -ComputerName Server -ScriptBlock { & cmd.exe /c mklink /j c:\junction c:\real }

# or if you want to keep it 100% powershell
Invoke-Command -ComputerName Server -ScriptBlock { New-Item -ItemType Junction -Path c:\junction -Value c:\real }

To the client who has I: mapped to a \\Server\c$ share, this would be the equivalent of creating an I:\junction pointing to I:\real.

Upvotes: 3

henrycarteruk
henrycarteruk

Reputation: 13227

The sysinternals junction util mentions:

Note: that Windows does not support junctions to directories on remote shares.

I can't find any MS KB article that confirms this, but I'm inclined to believe Mark Russinovich on this as he really knows his stuff.

Upvotes: 1

Related Questions