How to add a shortcut to a network share that is not connected to the network? (Win2k8 R2)

tbalz
tbalz used Ask the Experts™
on
I need to create desktop shortcuts to folders that are on a remote linux system which are not currently connected to the Virtual Machine I'm testing out. Is there anyway to do this in Win2k8 r2? For example the remote linux name of the computer I'm installing my files on is \\bob1\desktop. How would i create the shortcut in Windows without bob actually being connected to the network
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Solutions Architect
Commented:
You can do it various ways.  You can create shortcuts via group policy preferences.  So the shortcut will not show up until the share is available.  Probably the best way would be to use a small VBS script.  Copy the code below into a file called shortcut.vbs.  Then run it on the target computer.  Change the TargetPath and NewShortcutName as well as WorkingDirectory to match your needs.

set WshShell = WScript.CreateObject("WScript.Shell" )
strDesktop = WshShell.SpecialFolders("Desktop" )
set objLink = WshShell.CreateShortcut(strDesktop & "\NewShortcutName.lnk" )
objLink.TargetPath = "\\bobs\youruncle"
objLink.WindowStyle = 1
objLink.IconLocation = "\\bobs\youruncle\someicon.ico"
objLink.Description = "Shortcut Script"
objLink.WorkingDirectory = "\\bobs\"
objLink.Save

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial