?
Solved

sharepoint network shortcut

Posted on 2014-08-16
11
Medium Priority
?
744 Views
Last Modified: 2014-08-27
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
0
Comment
Question by:john15nlt
  • 7
  • 4
11 Comments
 
LVL 11

Expert Comment

by:Chris Gralike
ID: 40266015
Hi John,

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

rgrds,
0
 
LVL 1

Author Comment

by:john15nlt
ID: 40266105
this is the difference between a clean share and a dirty share
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.
0
 
LVL 11

Expert Comment

by:Chris Gralike
ID: 40266205
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.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:john15nlt
ID: 40266553
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
0
 
LVL 11

Expert Comment

by:Chris Gralike
ID: 40266555
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 ;-)
0
 
LVL 11

Accepted Solution

by:
Chris Gralike earned 2000 total points
ID: 40266571
Please give this a try:
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

strShortcutName = "Testfolder"
strShortcutPath = "\\sp.company.nl@SSL\SITENAME\Shared Documents\"

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

Open in new window

0
 
LVL 11

Expert Comment

by:Chris Gralike
ID: 40266579
Just tested it.
It opens up an explorer window like expected.
0
 
LVL 1

Author Closing Comment

by:john15nlt
ID: 40266643
Great job thanks,
0
 
LVL 1

Author Comment

by:john15nlt
ID: 40288730
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.
0
 
LVL 11

Expert Comment

by:Chris Gralike
ID: 40289143
webdav is required. im not sure windows xp its explorer proces supports webdav without additional config.

rgrds Chris
0
 
LVL 11

Expert Comment

by:Chris Gralike
ID: 40289162
webdav is required. im not sure windows xp its explorer proces supports webdav without additional config.

rgrds Chris
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
By default the complete memory dump option is disabled in windows . If we want to enable the complete memory dump for a diagnostic purpose, we have a solution for it. here we are using the registry method to enable this.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question