Community Pick: Many members of our community have endorsed this article.
Editor's Choice: This article has been selected by our editors as an exceptional contribution.

Fixing Disappearing Desktop Shortcuts in Windows 7

Lee W, MVPTechnology and Business Process Advisor
CERTIFIED EXPERT
Jack of All Trades with an interest in facilitating networking through social interaction of IT Professionals
Published:
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.  

1

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

2

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:

1

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

2

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

3

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

4

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.
16
17,739 Views
Lee W, MVPTechnology and Business Process Advisor
CERTIFIED EXPERT
Jack of All Trades with an interest in facilitating networking through social interaction of IT Professionals

Comments (3)

Lee W, MVPTechnology and Business Process Advisor
CERTIFIED EXPERT
Most Valuable Expert 2013

Author

Commented:
And thanks WaterStreet
The specific issue seems to be when a user goes above 4 shortcuts which saw that there is an issue with a limitation of WMI class in windows 7.

However, the issue ONLY arises on stations which only have "power user" rights assigned to the local box.  Anyone with "admin or full rights" to the local box can create as many shortcuts as they want and they never disappear.  But the power user creates 4 shortcuts they are fine but when they create the 5th or more shortcuts, that makes all their shortcuts disappear either the next day or in a day or two.

If it is a limitation issue then why the seeming permissions affecting the issue?
Lee W, MVPTechnology and Business Process Advisor
CERTIFIED EXPERT
Most Valuable Expert 2013

Author

Commented:
I wrote this up after one client experienced this.  However, that client makes the users Admins, NOT Power Users.  Personally, I have not seen the issue myself.  As the KB article makes no mention of user rights and permissions, I would suggest you take a closer look because it would seem the problem should occur to EVERYONE.

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.