Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

change target path of link via vb script (login script)

Avatar of Kevin Smith
Kevin SmithFlag for United States of America asked on
Visual Basic Classic
6 Comments1 Solution712 ViewsLast Modified:
I have the following code that loads a front end database on the user's workstation, copies the shortcut and puts the link on their desktop:

Dim WshShell
Dim Return
Dim sUserProf
Dim lResp

On Error Resume Next

Const sLocalFolder = "C:\Program Files\SARs\"
Const sMDE = "sars3v1.adp"
Const sNetworkPath = "\\synserver\SYNDATA\Data Interface\"
Const sLink = "\\synserver\SYNDATA\Data Interface\sars3v1short.lnk"
Const sLinkFile = "SARs 3.lnk"

Set WshShell = CreateObject("Wscript.Shell")
Set WshNetwork = Wscript.CreateObject("Wscript.Network")
sUserProf = WshShell.ExpandEnvironmentStrings("%userprofile%")
Set FSO = CreateObject("Scripting.FileSystemObject")

     If Not FSO.FolderExists(sLocalFolder) Then


     End If

FSO.CopyFile sLink, sUserProf & "\Desktop\" & sLinkFile, True
Set FSO = Nothing

Update sNetworkPath, sLocalFolder, sMDE

'clean up
Set WshShell = Nothing

Private Sub Update(sNetworkPath, sLocalFolder, sMDE)


On Error Resume Next

     Set FSO = CreateObject("Scripting.FileSystemObject")
     FSO.CopyFile sNetworkPath & sMDE, sLocalFolder & sMDE, True
     'clean up
     Set FSO = Nothing


It works great, but I had an issue with a TS user because my link (on the server) is set for a target of the user's hard drive...so when they login via TS, the link's target is trying to access a C drive path.  How do I copy the link just as above, and THEN change the target path of the link once it's on my user's computer?

Avatar of Shane Russell
Shane RussellFlag of United Kingdom of Great Britain and Northern Ireland image2nd Line Desktop Support

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answers