We're consolidating five file servers onto two new servers that connect to a System Area Network (SAN). Our users rely heavily on shortcuts. How can we automate the process of changing all the desktop shortcuts?

Making a specific recommendation is challenging without knowing your client platform (e.g., Win2K, NT) and whether your clients support a scripting environment other than the command processor. Thus, here are several options that you can explore:

  • Use WSH. The WshShell object exposes the CreateShortcut method that you can use to not only create shortcuts but also update them. To update an existing shortcut, simply pass its path to CreateShortcut. Because the shortcut already exists, CreateShortcut returns a reference to the existing shortcut rather than creating a new one. You can then use the returned reference to update the existing shortcut's TargetPath property or change any of the other properties that the WshShortcut object exposes (i.e., Arguments, Description, FullName, Hotkey, IconLocation, WindowStyle, and WorkingDirectory). After you've made your changes, call the WshShortcut object's Save method to write those changes to the shortcut. For more information about CreateShortcut, go to http://msdn.microsoft.com/scripting/windowshost/doc/wsmthcreateshortcut.htm.


  • Create new shortcuts (i.e., .lnk files). After you create the .lnk files, copy them to the users' Desktop folder. You can perform the copy operation as part of the users' logon script or simply push the files to the target clients remotely.


  • Use Windows Management Instrumentation. WMI exposes shortcuts through the Win32_ShortcutFile class. For information about this class, go to http://msdn.microsoft.com/library/default.asp?pp=/library/toc/psdk/management/management0-7-7-0-1.xml&tocpath=management0-7-7-0-1&url=/library/psdk/wmisdk/clascomp_3d4j.htm. The Win32_ShortcutFile class is in the Operating system category.


  • Use the Win32::Shortcut module. To download this Perl module and obtain general usage instructions, go to http://velocity.activestate.com/code/cpan/w/wi/Win32Shortcut.html.