Fixing Disappearing Desktop Shortcuts in Windows 7

Published on
36,552 Points
16 Endorsements
Last Modified:
If you've occasionally noticed missing shortcuts from your Windows 7 Desktop, it's because Windows 7 runs maintenance tasks periodically and cleans up things that don't work.  One of these tasks is to clean up and remove broken shortcuts on your desktop.  If you have more than 4 or more broken shortcuts, on the desktop when the maintenance occurs, Windows will automatically delete them (after all, who wants broken shortcuts on their desktop).

What does Windows consider a broken shortcut?  A shortcut to a file that's no longer available, a shortcut to a network drive that's no longer available, or a shortcut to a program that's no longer available would all be examples.  People who create a shortcut to a work report on their desktop at home that they access via VPN would be considered broken if the maintenance routines run when they are not connected to the VPN.  A shortcut to the network drive that contains all your office files on your office server would be considered broken if it were on a laptop that was taken on a trip.  A shortcut to a program that you placed on the desktop but since have uninstalled would also be considered broken.  And if you have more than 3 of these TOTAL, then Windows will delete them all, by default, when the maintenance is done.

Microsoft suggests two things to prevent this in their support article (Desktop shortcuts disappear in Windows 7; KB 978980) on the subject - neither of which seems very appealing.  


Don't put shortcuts on your desktop that can be broken at times (this suggestion, to me, is silly at best)


Disable the System Maintenance troubleshooter, which will disable all the maintenance tasks that it performs (this seems extreme and generally unwise)
As a third option, you can do the following - just be careful, any time you modify system settings one wrong keystroke at the wrong time could have seriously damaging results:


Take Ownership of the file C:\Windows\diagnostics\scheduled\Maintenance\TS_BrokenShortcuts.ps1


Adjust the permissions on the file same file so that your user account has full control


Right-click and select "edit" on the file - OR open notepad with administrative rights and then open the file in notepad.
Then change the file so that lines 12 through 20 begin with a # symbol - like this:
#    Get-ChildItem -Path $path -filter *.lnk | Foreach-Object {
#        $fullPath = ConvertTo-WQLPath $_.FullName
#        $wmiLinkFile = Get-WmiObject -query "SELECT Name,Target,AccessMask FROM Win32_ShortcutFile WHERE Name = '$fullPath'"
#        if(-not(Test-ValidLink $wmiLinkFile) -and (Test-Delete $wmiLinkFile))
#        {
#            $list = AttachTo-List $list $wmiLinkFile.Name
#        }
#    }

Open in new window


Save the file
That should do it.  You've just changed the script that does the desktop cleanup so that whenever it runs, it should find no broken links at all - the function that would have found them should always return an empty list.  (The # comments out the line so, if you ever want to restore the functionality, you just need to remove the # symbols starting each of those lines - just be careful not to remove them from lines 1, 3, or 8 as those are actual "FYI" comments that belong there - like little notes explaining what's going on)

I found similar instructions on the internet, but decided to provide this version since I preserve the file in a state you can easily restore later; the other instructions I've found tell you to delete those lines and my philosophy is that it's always easier to undo something commented out than to recreate it or copy it from another system.
Author:Lee W, MVP
Ask questions about what you read
If you have a question about something within an article, you can receive help directly from the article author. Experts Exchange article authors are available to answer questions and further the discussion.
Get 7 days free