Link to home
Start Free TrialLog in
Avatar of john15nlt
john15nltFlag for United States of America

asked on

sharepoint network shortcut

Please read all of this before you respond.

I have a sharepoint site that I need to create a network share and I need it to have a clean appearance.

What I want I can not seem to have, if I create a network shortcut from the gui in windows 7, explorer, computer, map network drive, select "connect to a Web site ..." what I get is a very clean looking shortcut under the mapped drive letters with very clean names.

I need to either be able to do this task 1. from a command prompt 2. from a vbs script 3. by a manual manipulation of the registry.

I can create a folder using net use but what I get is not a clean share, this is not about me this is about my user community that does not like change, and will not like shares with dirty names, it just confuses them.

Can anyone help
Avatar of Member_2_3684445
Member_2_3684445
Flag of Netherlands image

Hi John,

What does 'clean' mean in this context? could you please elaborate on this?

rgrds,
Avatar of john15nlt

ASKER

User generated image
Users was created with net use, johnshared was created via the map network drive interface in explorer.  I know there has to be a way to programmatically/command line create the second one.
Hi John,

You post is somewhat confusing.
The folder that you see is in fact a shortcut, not a network location.

The network shortcuts are stored at:
C:\users\{username}\AppData\Roaming\Microsoft\Windows\Network Shortcuts\{Location}\target.lnk
C:\users\{username}\AppData\Roaming\Microsoft\Windows\Network Shortcuts\{Location}\desktop.ini

You can programmically create them using vbs. I didnt test it, but this might do the job:
http://ss64.com/vb/shortcut.html
http://community.spiceworks.com/scripts/show/229-add-shares-to-my-network-places

A quick glance at the script makes me wonder if the path / pathtrees are right. But those are easly altered.
Ok now we are getting somewhere.. the scripts are close but are pretty much what I have already been dealing with they create a shortcut in C:\users\{username}\AppData\Roaming\Microsoft\Windows\Network Shortcuts\ however when you create this link via the gui it creates a directory and then the link is inside that folder.

I was able to modify the script to get it to create a folder and the link inside that folder, however instead of opening that link in explorer (which is what I am after) it opens a browser.. notice also the links are not the same.

Set WSHShell = CreateObject("WScript.Shell")
Dim oFSO
Set oFSO = CreateObject("Scripting.FileSystemObject")

Const NETHOOD = &H13&

Set objWSHShell = CreateObject("Wscript.Shell")

Set objShell = CreateObject("Shell.Application")

Set objFolder = objShell.Namespace(NETHOOD)
Set objFolderItem = objFolder.Self


strNetHood = objFolderItem.Path


strPath = objFolderItem.Path & "\*.*"
On Error Resume Next
objFSO.DeleteFile strPath, true

strShortcutName = "NewShare"
strShortcutPath = "https://XXXXXX/users"

strNetHood = strNetHood & "\" & strShortcutName
wscript.echo strNetHood
oFSO.CreateFolder strNetHood

Set objShortcut = objWSHShell.CreateShortcut _
(strNetHood & "\target.lnk")
objShortcut.TargetPath = strShortcutPath
objShortcut.Save


WSCript.Quit


Any thoughts?
networkshares.JPG
Hi John,

Give me a few moments.

I will see if i can script something for you.
This might take a short while because i need to finish something else first.

I hope you dont mind ;-)
ASKER CERTIFIED SOLUTION
Avatar of Member_2_3684445
Member_2_3684445
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just tested it.
It opens up an explorer window like expected.
Great job thanks,
This is a followup, this works on windows 7 without a hitch.  It will also create the shares in windows xp without a problem.  the issue is that in windows xp they will not work.  I am not sure where the breakdown is (some where in the windows web services api) or somewhere else.

If someone could help me navigate this issue that would be great.
webdav is required. im not sure windows xp its explorer proces supports webdav without additional config.

rgrds Chris
webdav is required. im not sure windows xp its explorer proces supports webdav without additional config.

rgrds Chris