<

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

Fixing Disappearing Desktop Shortcuts in Windows 7

Published on
36,289 Points
16,689 Views
16 Endorsements
Last Modified:
Awarded
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
Comment
Author:Lee W, MVP
  • 2
3 Comments
LVL 98

Author Comment

by:Lee W, MVP
And thanks WaterStreet
0

Expert Comment

by:wmandallp
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?
0
LVL 98

Author Comment

by:Lee W, MVP
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.
0

Featured Post

Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

Join & Write a Comment

In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month