Link to home
Start Free TrialLog in
Avatar of 2toria
2toriaFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Copying a shortcut link using VBS script

Hi chaps,

I'm having a bit of a struggle trying to get a script to work which copies a shortcut lnk file from a server share to a users desktop.  I've found the attached code below on here and changed it to my needs, but I get a problem in that I get a message saying that in line 6 there is an error as the file specified cannot be found.  I know it's there and have checked everything.

The only thing I can think of is that I'm trying this over a VPN connection.  Would that make a diffference?

Any help would be appreciated.
Matt
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Set objProcess = objShell.Environment("Process")
strDesktop = objProcess.Item("UserProfile") & "\Desktop\"
boolOverwrite = False
objFSO.CopyFile "\\myServer\myShare$\InfoChecking\Auditing.lnk", strDesktop, boolOverwrite

Open in new window

Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

try add the network credentials to your server before copy using cmdkey:
https://www.experts-exchange.com/questions/22676274/VBScript-authentication-to-remote-PC-and-file-copy.html
Avatar of 2toria

ASKER

I don't have admin rights to do this and doubt our network guys will change stuff just for me, unfortunately...  Is there any other way I can get this to work?  Is it to do with VPN access?
What about setting this up in a logon script, so that it runs with the proper permissions?
Avatar of 2toria

ASKER

I don't have administrator access to carry this kind of thing out unfortunately.
ASKER CERTIFIED SOLUTION
Avatar of Darren Collins
Darren Collins
Flag of United Kingdom of Great Britain and Northern Ireland 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