Repairing desktop left after a migration

Problems with links and shortcuts quickly arise as soon as the paths change when migrating a file server. This article is about the ones that have been placed on their desktops. These could show files or links. If the hard disk structures change during a migration, then they stop functioning.

In environments where UNC-paths (ex .: \\ server \ share \ directoryXY) are used as a direct path to the file server, we have found that the paths are changed. It is common for the end users to have their desktops that show them the way to folders and documents on the servers. This document will introduce you to a simple script that replaces the paths for them.

This script is written in VBScript. The first lines define the old and new path.

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

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

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