PSH Oneliner: Fix Up App-V Shortcuts When Migrating from SCCM 2007 to 2012 (Can be used for global fixup of shortcuts of any type) Print E-mail
PowerShell
Written by Darwin Sanoy   
Friday, July 11, 2014 7:23am

Even if you followed the Microsoft playbook exactly when doing App-V 4.6 on SCCM 2007, when you migrate to SCCM 2012 you may be in for some pain.  The App-V shortcuts installed by SCCM link to a special launcher that is part of the SCCM clinet.  In the case of 2007, this is probably linked to "c:\windows\syswow64\ccm\vapplauncher.exe".  These links end up breaking when the SCCM 2007 client is removed while upgrading to the 2012 client.  The following PowerShell Oneliner screams through (yes it is quick) the Win32_Shortcut WMI name space to find all shortcuts to this file and updates them very quickly!

A key benefit to using this method versus a symbolic link to vapplauncher.exe is that you are forever free from the old location and won't discover dependencies on it months down the road.  This will need to run with administrator rights to be able to update per-machine shortcuts.  It should also find all shortcuts for all users - so there is no need to run under a regular user context.

Although it does not trap errors, it does create a log that should capture them.


$ErrorActionPreference = 'Continue' ; start-transcript $env:systemdrive\users\public\scfixup.log ; gwmi win32_shortcutfile -Filter "Drive='c:' AND Target='c:\\windows\\
sysWOW64\\ccm\\vapplauncher.exe'" | % {"Found and updating: $($_.description)" | out-default ; $sc = (new-object -com wscript.shell).createShortcut("$($_.description)");$sc.targetpath='c:\windows\ccm\vapplauncher.exe';$sc.save();$sc = $null} ; stop-transcript