Thursday, December 12, 2013

Migrate Shortcuts to Files on Network Drive

I have struggled to figure out how to use USMT 4.0 and SCCM 2012 SP1 to migrate user desktop's shortcuts which point to network drive during Win7 migration. Shortcuts are not migrate from XP to Win7 :(

The best result I can had was backup and restore the shortcut which pointed to the network drive but not the shortcuts which point to a file in network drive.

And I read below:
http://blogs.technet.com/b/mniehaus/archive/2011/08/24/troubleshooting-the-user-state-migration-tool-4-0.aspx


  • Shortcuts to files on network drives don’t migrate

    • Known issue, you can modify MigUser.xml to remove section with IgnoreIrrelevantLinks (but then all links are retained, even invalid ones).
    I have decided to script it and work together with SCCM Task Sequence in order to migrate all the users' desktop shortcuts.

    To backup shortcut:
    Put below script before USMT step which able to backup all users' desktop shortcut files:

    cd /d %windir%/../Users
    for /f "delims=*" %%i in ('dir/b') DO xcopy %%i\Desktop\"*.lnk" D:\shortcuts\%%i\ /Y /B /Z /G

    To restore shortcut:
    Put below script at any steps after USMT which able to restore all the user's shortcut files:

    cd /d %windir%/../Users
    for /f "delims=*" %%i in ('dir/b') DO xcopy D:\shortcuts\%%i\*.* %%i\Desktop\ /Y /B /Z /G

    Then, remember to delete the D:\shortcuts folder after the shortcut restoration step.

    The scripts worked perfectly in my Win 7 migration. I am able to migrate all the shortcuts to files on network drive (NOTE: limit to User's desktop only).

    Tuesday, December 3, 2013

    How to Delete File(s) with Similar Name from Different Users' Desktop?

    If you want to manage file/shortcut on all the Win 7 Users' Desktops, you can always navigate to C:\Users\Public\Desktop or %AllUsersProfile% to delete or add the file/shortcut.

    I want to use SCCM Task Sequence to delete some shortcuts with similar file name under different users' desktop today. I tried to Google around but most of the blog lead me to %userprofile% which delete the file/shortcut on the current logon user's desktop only

    After google around, check with my script mater (Mr Brian Rayel) and testing, finally we able to delete files with similar names under different user desktops.

    Option 1:
    @echo off
    cd C:\Users
    for /d %%i in (*.*) do del %%i\Desktop\"Sample Of Shortcut*.lnk"

    Option 2 (credit to my colleague, Master Brian Rayel):
    @echo off
    cd /d %windir%/../Users
    for /f "delims=*" %%i in ('dir/b') DO del %%i\Desktop\"Sample Of Shortcut*.lnk" /q

    It will remove all the shortcut start with Sample Of Shortcut*.lnk. For example, Sample Of Shortcut1.lnk, Sample Of Shortcut2.lnk and etc under different user's Desktop.

    Happy trying. :)