Automatically repair desktop shortcuts after server migration

As soon as the paths change when a file server is migrated, problems with links and links quickly occur. This article is about the shortcuts that users put themselves on the desktop. These could point to files or directories.

If the drive structures change during a migration, they no longer work.

In environments where UNC paths (for example: \\ server \ share \ directory) are the direct route to the
File servers are used, we have found a way to solve the problems for end users
minimize, even if the paths are changed. It is common for end users to link up
have their desktops show them the way to folders and documents on the servers.
I want to introduce you to a simple script that replaces the paths for you.

This script is written in VBScript. In the first lines are old and new path.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
'Define paths
strFind = "\\ oldserver \ share1 \"
strReplace = "\\ newserver \ share2 \"

Set objWsh = CreateObject ("WScript.Shell")
Set objWshSysEnv = objWsh.Environment ("PROCESS")
strProfilePath = objWshSysEnv ("USERPROFILE")

Set objFSO = CreateObject ("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder (strProfilePath & "\ Desktop")

'Loop through all files on the desktop
For Each fillet In objFolder.Files
if right (file.Name, 3) ="Lnk" then
'If a shortcut is found
Set objLink = objWsh.CreateShortcut (file.Path)

objLink.Arguments = Replace (objLink.Arguments, strFind, strReplace, 1, -1,1)
objLink.TargetPath = Replace (objLink.TargetPath, strFind, strReplace, 1, -1,1)
objLink.WorkingDirectory = Replace (objLink.WorkingDirectory, strFind, strReplace, 1, -1,1)

objLink.Save
end if
Next
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Include this script in your login script and you will have a less problem the day after your file server migration.

Source: http://365lab.net/2014/02/17/fix-broken-shortcuts-during-file-server-migrations/

Permanent link to this post: https://help.migraven.com/defekte-links-auf-desktop-reparieren/