• Author
Posts
• #216036
Participant
Topics: 7
Replies: 34
Points: 118
Rank: Participant

How can I create a symbolic link between a network drive and a non-network drive ? I was never able to get it to work within command.

Also is there a way to append a sub-folder to a symbolic link; the -Path flag of a symbolic link must be non-existent for a symbolic link to be created ?

• #216045
Participant
Topics: 3
Replies: 342
Points: 1,130
Rank: Community Hero

What have you tried?

• #216051
Participant
Topics: 7
Replies: 34
Points: 118
Rank: Participant

I only tried the New-Item along with symbolic with the -Path and -Target.

• #216057
Participant
Topics: 3
Replies: 342
Points: 1,130
Rank: Community Hero

Most forums are designed to help, not do for. 🙂 Usually there is some code that isn’t working, and we can try to help getting it to work.

• #216060
Participant
Topics: 7
Replies: 34
Points: 118
Rank: Participant

Most forums are designed to help, not do for. 🙂 Usually there is some code that isn’t working, and we can try to help getting it to work.

I understand, I just want to know what is missing as to get network drives first of all to create a symbolic link ?

• #216066
Participant
Topics: 3
Replies: 342
Points: 1,130
Rank: Community Hero

Well I honestly believe you haven’t spent much time on this and are just asking someone else to tell you the answer. Either way, I’ll share my knowledge in case it helps.

The biggest issue I see people run into, is the path (directory or file) already exists. The process you are trying to do is CREATE a symbolic link – meaning it can’t already be there. You can create a symlink on your local drive that points to a network share, including subdirectories. See my examples below.

Scenario 1: Create a symbolic directory link on workstation1 to network share \\server2\share. This command would be run on workstation1

New-Item -ItemType SymbolicLink -path C:\Temp\Linktest -Target \\server2\share



This will create a symlink directory in C:\Temp that looks just like a normal folder to the user (outside the shortcut icon on the folder.) They can create folders/files in here, and those folders files are actually being created in \\server2\share

Scenario 2: Create a symbolic directory link on workstation1 to network share \\server2\share\folder\in\share. This command would be run on workstation1

New-Item -ItemType SymbolicLink -path C:\Temp\Linktest -Target \\server2\share\folder\in\share



This will do the same as scenario 1, but the files/folder created in c:\temp\linktest are actually being written to \\server2\share\folder\in\share\

I hope this helps.

• This reply was modified 1 month, 3 weeks ago by Doug Maurer.
• #216126
Participant
Topics: 7
Replies: 34
Points: 118
Rank: Participant

Well I honestly believe you haven’t spent much time on this and are just asking someone else to tell you the answer. Either way, I’ll share my knowledge in case it helps.

The biggest issue I see people run into, is the path (directory or file) already exists. The process you are trying to do is CREATE a symbolic link – meaning it can’t already be there. You can create a symlink on your local drive that points to a network share, including subdirectories. See my examples below.

Scenario 1: Create a symbolic directory link on workstation1 to network share \\server2\share. This command would be run on workstation1

PowerShell
3 lines

<textarea class=”ace_text-input” style=”opacity: 0; height: 18px; width: 6.59781px; left: 44px; top: 0px;” spellcheck=”false” wrap=”off”></textarea>

1
2
3
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

This will create a symlink directory in C:\Temp that looks just like a normal folder to the user (outside the shortcut icon on the folder.) They can create folders/files in here, and those folders files are actually being created in \\server2\share

Scenario 2: Create a symbolic directory link on workstation1 to network share \\server2\share\folder\in\share. This command would be run on workstation1

PowerShell
3 lines

<textarea class=”ace_text-input” style=”opacity: 0; height: 18px; width: 6.59781px; left: 44px; top: 0px;” spellcheck=”false” wrap=”off”></textarea>

1
2
3
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

This will do the same as scenario 1, but the files/folder created in c:\temp\linktest are actually being written to \\server2\share\folder\in\share\

I hope this helps.

Once one has created a symbolic link, is it possible to append a sub-folder the folder which is the Link ?

• #216135
Participant
Topics: 3
Replies: 342
Points: 1,130
Rank: Community Hero

I’m not sure I understand the question. In the examples above, if you go into the symbolic link and create a sub folder, it is created in the target. If you’re wanting something like c:\temp\testlink\folder – then I’d say no because c:\temp\testlink isn’t a directory itself, it is just a shortcut. You could create another link pointing at the same target, but that link would need to be contained in a directory.

• #216138
Participant
Topics: 7
Replies: 34
Points: 118
Rank: Participant

What if you created the symbolic link, but now want to add a sub-folder can this be done or must I delete the old symbolic link and create it from scratch ?

You could create another link pointing at the same target, but that link would need to be contained in a directory.

?

• #216147
Participant
Topics: 3
Replies: 342
Points: 1,130
Rank: Community Hero

I hope this helps you.

• #216243
Participant
Topics: 7
Replies: 34
Points: 118
Rank: Participant

Thanks for the help 🙂

• #216522
Participant
Topics: 3
Replies: 342
Points: 1,130
Rank: Community Hero

You are welcome. To clarify, if you create a folder in the symlink folder and navigate to it, it looks like it is that path. For example if you go to the testlink above, create a directory, navigate into that directory – it will show c:\temp\testlink\newfolder in the explorer address bar. In fact any folder in there whether created through the symlink or directly through the shared path, will look local when accessed through the symlink.

Interestingly when you target the symlink to make a new symlink – it creates it just fine.





Of course it creates it in the actual target folder. I thought that was interesting. So I guess to correct my answer, yes you can add a subfolder – it will exist in the target folder. Regarding “appending” to the symlink, if you really need a directory before the symbolic link and it needs to actually be local, you’d need to delete the symlink so you could create a folder with the same name as previously stated. Unfortunately you can’t do New-Item -ItemType SymbolicLink -Path c:\temp\testlink1\testlink1 -Target \\server\share\folder unless c:\temp\testlink1 already exists.

• #227230
Participant
Topics: 7
Replies: 34
Points: 118
Rank: Participant

An update, I tried the code you posted in your recent reply, and PowerShell continuously give me an error for a network drive.

I set the -path flag to the folder which is the source and the -Target flag to the target directory which is on a NAS; in either case, nothing works ?

• #227287
Participant
Topics: 6
Replies: 93
Points: 428
Rank: Contributor

I dont see any mention of the -Force option to New-Item. Will that solve your problem?

• #227317
Participant
Topics: 3
Replies: 342
Points: 1,130
Rank: Community Hero

Perhaps you can paste the code you tried so there is no assuming going on. The folder “source” as you call it, must not exist. The symbolic link creation process will make the link. Make sure you’re not pointing at a preexisting item.

In a directory I want a shortcut named “Symboliclink” – this item must not exist already.

$path = "c:\temp\symboliclink"$target = "\\server\share\folder"

get-childitem $path # error for item not found New-Item -ItemType SymbolicLink -path$path -Target $target Get-ChildItem$path # should list anything contained in the $target directory  • #227998 Participant Topics: 7 Replies: 34 Points: 118 Rank: Participant The source must not exist, therefore this is what I did; $path = "H:\CloudSync" < Non-existent
$target = "\\crex2cloud\bacupsync" New-Item -ItemType SymbolicLink -path$path -Target $target Powershell pauses then I get the error Cannot find path \\crex2cloud\bacupsync because it does not exist; although it does exist ? • #228004 Participant Topics: 3 Replies: 342 Points: 1,130 Rank: Community Hero Sure you didn’t misspell a word? $target = "\\crex2cloud\bacupsync" # Not bac K upsync?


If that’s spelled correct, what happens if you run this?

Push-Location "\\crex2cloud\bacupsync"

• #228040
Participant
Topics: 7
Replies: 34
Points: 118
Rank: Participant

Sure you didn’t misspell a word?

<textarea class=”ace_text-input” style=”opacity: 0; height: 18px; width: 6.59781px; left: 44px; top: 0px;” spellcheck=”false” wrap=”off”></textarea>

1
2
\$target = “\\crex2cloud\bacupsync” # Not bac K upsync?
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

If that’s spelled correct, what happens if you run this?

<textarea class=”ace_text-input” style=”opacity: 0; height: 18px; width: 6.59781px; left: 44px; top: 0px;” spellcheck=”false” wrap=”off”></textarea>

1
2
Push-Location “\\crex2cloud\bacupsync”
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Same error ?

• #228043
Participant
Topics: 3
Replies: 342
Points: 1,130
Rank: Community Hero

If you can’t push-location into it, then that system doesn’t recognize the path. I’d recommend you confirm the spelling/path. You say the path is valid, but this PC doesn’t think so. If you can navigate to it in explorer, perhaps you should copy/paste the path into your command to ensure accuracy.

• #228046
Participant
Topics: 7
Replies: 34
Points: 118
Rank: Participant

I tried copying and pasting the path.  I tried the UNC path, as well as the assigned letter path which is T, in either case it doesn’t work.  The path exists in Windows explorer, but Powershell cannot find the path ?

• #228049
Participant
Topics: 3
Replies: 342
Points: 1,130
Rank: Community Hero

Does this work in powershell?

ping crex2cloud

• #228133
Participant
Topics: 7
Replies: 34
Points: 118
Rank: Participant

When I ping crex2cloud, I get a response; this is what I want to know what I’m doing wrong or what is going wrong ?

• #228157
Participant
Topics: 3
Replies: 342
Points: 1,130
Rank: Community Hero

My assumption is bacupsync should actually be spelled backupsync. But since you say that is not the case and you have copied the working directory from explorer, it makes no sense. I would check the basics again, because it just seems like there is something simple being overlooked.

• #228292
Participant
Topics: 7
Replies: 34
Points: 118
Rank: Participant

I’m intentionally spelling it as bacupsync 🙂 I’ll review everything once again to see if there is anything wrong; then again maybe it’s the NAS causing issues, if you’ve heard of that before ?

• #228322
Participant
Topics: 3
Replies: 342
Points: 1,130
Rank: Community Hero

Does this work? In a command prompt console try

Pushd "\\crex2cloud\bacupsync"

• #232885
Participant
Topics: 7
Replies: 34
Points: 118
Rank: Participant

Does this work? In a command prompt console try

<textarea class=”ace_text-input” style=”opacity: 0; height: 18px; width: 6.59781px; left: 44px; top: 0px;” spellcheck=”false” wrap=”off”></textarea>

1
2
Pushd “\\crex2cloud\bacupsync”
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I tried that, it says the path does not exist, then it does exist ?