Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, June 21, 2012 4:17 PM
Hello,
I am trying to create a powershell batch file that will create a bunch of Network Folder shortcuts for Sharepoint document libraries. Sorry about the bolding below but when asking this question previously there is some confusion as many people dont know what a Network Folder shortcut is when compared to an Internet Shortcut.
To get an idea, the manual method would be to go to Computer --> Right Click --> Add Network Location
From here I can enter the URL path to a Sharepoint document library and it will create a Network Folder shortcut to that document library allowing people to access the library without having to go through Sharepoint to get to it. So when the user clicks on the shortcut it opens an explorer window to view and work with the files.
I found the following script, but it is creating an "Internet Shortcut" when I put in the path instead of a Network Folder shortcut. So when the user clicks it, it just opens the web page instead of an Windows Explorer window. Any help would be great! Thank you!
[Environment]::GetFolderPath("ApplicationData")
$path = [Environment]::GetFolderPath("ApplicationData") + "\Microsoft\Windows\Network Shortcuts\ACL Documents.lnk"
$comobject = New-Object -comObject WScript.Shell
$link = $comobject.CreateShortcut($path)
#targetpath can be UNC path or physical path to .exe
$link.targetpath = "https://finance.domain.net/ACL/Shared%20Documents"
$link.IconLocation = "%SystemRoot%\system32\imageres.dll,137"
$link.Save()
Thank you
All replies (6)
Friday, June 22, 2012 3:02 AM
Hi,
Have you refer to the below thread to create shortcut?
Create Shortcut In My Network Places Using PowerShell
http://social.technet.microsoft.com/Forums/da/ITCG/thread/bd00d576-6096-4c8d-bd82-3c5853eb6675
I would like suggest you to create shortcut for another site and check the result, it seems like for me that the script works, but the shortcut is not you expected. But if the https://finance.domain.net/ACL/Shared%20Documents is designed this way, this should be expected.
Please create shortcut for a http site and check the result.
Hope this helps.
Regards,
Yan Li
If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback
here.
Yan Li
TechNet Community Support
Tuesday, June 26, 2012 4:08 PM
Well, the scripts works. But, what it is doing is creating an "internet" shortcut instead of a "file folder" shortcut.
Did some testing... Found out if I replace https with file ( then it opens up as an explorer view.
Tuesday, June 26, 2012 4:17 PM
Just change the $link.targetpath to something like 'c:\scripts\myfile.exe'
Grant Ward, a.k.a. Bigteddy
Tuesday, June 26, 2012 4:59 PM
Just change the $link.targetpath to something like 'c:\scripts\myfile.exe'
Grant Ward, a.k.a. Bigteddy
That won't work as he is working with a sharepoint document library, which is a website not a path to a drive
Friday, July 13, 2012 9:17 PM
Well, this script works, but for whatever reason when I click on the links I get a message that the path could not be found. Something is still not right. It created them right once out of 3 attempts... We have just been having to create them manually still.
Thursday, March 19, 2020 2:31 PM
I think you need to change your target path. It needs "@SSL\DavWWWRoot" then flip the slashes over so it reads like a windows UNC. I have not tested this in PowerShell, but I used this in Group Policy to create a Network Location for a SharePoint Library.
$link.targetpath = "finance.domain.net@SSL\DavWWWRoot\ACL\Shared Documents"