Fix Windows 7 Desktop Shortcuts Disappearing

Martin Brinkmann
Mar 30, 2010
Updated • Jul 27, 2016
Windows, Windows 7

If you run Windows 7 you may have noticed that desktop shortcuts disappear with no apparent reason whatsoever. Turns out that System Maintenance is responsible for that. It runs as a weekly maintenance service that affects desktop shortcuts in two ways.

It will first remove desktop shortcuts that have not been used for at least three months. System Maintenance will also remove broken shortcuts on the desktop if there are more than four of them. The problem with the latter is that Windows 7 will recognize shortcuts to disconnected network locations as broken and also shortcuts that link to shell folders.

Microsoft offers two solutions to the problem. The first advice is to keep the number of broken shortcuts below four. This is not always possible due to the problems with broken shortcuts mentioned above.

The second suggestion by Microsoft is to turn off Computer Maintenance:

  • Click Start, and then click Control Panel.
  • Under System and Security, click Find and fix problems.
  • On the left navigation pane, click Change settings.
  • Set Computer Maintenance to Off.

This does however turn off all other computer maintenance related tasks like checking the system time, disk volume errors or the disk space error reports.

All the maintenance tasks are powered by scripts that are located in c:\windows\Diagnostics\Scheduled\Maintenance\. Options are to edit the scripts directly in that directory. The permissions prohibit that the files are edited by the current user.

Fixing Windows 7 Desktop Shortcuts Disappearing

Please note: This is a hack which may impact other parts of the operating system. Everything worked fine afterwards on a test system but make sure to backup the files properly before editing them

First we need to take control of the files so that we can edit them. To do that you need to take ownership first, and then modify the access rights of the current user so that the files can be modified.

The first part can be automated. Just download the script at this forum and execute it. This should add a Take Ownership entry to the right-click menu in Windows Explorer.

Go to C:\Windows\diagnostics\scheduled\Maintenance in Windows Explorer after installing the script and right-click the file TS_BrokenShortcuts.ps1. Select the Take Ownership option which should transfer ownership to the logged in user.

The user still does not have permissions to save the file which means that we have to complete the next step as well before we can edit the broken shortcuts Powerscript file so that it will not delete broken shortcuts automatically.

Open an elevated command line prompt. You do that by clicking on the Start orb, All Programs, then Accessories. Right-click the Command Prompt link and select to Run As Administrator.

Now issue the following command to grant the active user full rights of the file. Make sure you replace USERNAME with the name of the active user.

icacls c:\windows\diagnostics\scheduled\maintenance\TS_BrokenShortcuts.ps1 /grant USERNAME:F

Now you can edit the file normally in a text editor like Notepad. Open it and locate the line (line 11)

[string]$list = ""

Delete everything below that is below that line up to (line 22)

return $list

The lines that are deleted are:

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

This basically returns a blank list to the script so that no shortcuts get deleted. I have tested it with five broken shortcuts and they have not been deleted after running system maintenance.

That fixed the broken shortcuts but we still have the issue that shortcuts that have not been used for some time are deleted by Windows 7 as well.

We have to (almost) perform the same operation here. Locate the file TS_UnusedDesktopIcons.ps1 in the same directory. Take ownership of it and grant the active user access rights.

Edit the file afterwards and locate the line (24)

[string]$list = ""

Delete everything up to line (35)

return $list

so that the following lines get deleted

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'"
$lastAccessTime = Get-LastAccessTime $_.FullName

if((Test-ValidLink $wmiLinkFile) -and (Test-Delete $wmiLinkFile) -and (Test-FileShortcut $wmiLinkFile) -and (Test-Unused $lastAccessTime $threshold))
$list = AttachTo-List $list $wmiLinkFile.Name

Please note that I did not test the second script but it should work just as fine.

This should resolve all issues that users have with removed shortcuts on the Windows 7 desktop.

Make sure you backup the files properly before you edit them. Please let me know if this worked for you or if you have a better idea on how to fix the deleted shortcut problem in Windows 7.

Fix Windows 7 Desktop Shortcuts Disappearing
Article Name
Fix Windows 7 Desktop Shortcuts Disappearing
If shortcuts on the desktop of your Windows operating system disappear without user action, try the following fixes to get them back.
Ghacks Technology News

Tutorials & Tips

Previous Post: «
Next Post: «


  1. ZORRO said on January 4, 2019 at 11:57 am

    6 years after “fix” and
    it still deletes shortcuts, unbelievable! 2 more solutions —

    rightclick RunAsTI.exe run as admin
    cd \Windows\diagnostics\scheduled\Maintenance
    del TS_BrokenShortcuts.ps1
    del TS_UnusedDesktopIcons.ps1

    instead of removing existing commands add “exit 1” as the first line of

  2. Nate said on March 21, 2016 at 11:12 pm

    F-you Microsoft for this asinine auto-deletion masquerading as something necessary resulting in a waste of my time.

    THANK YOU, AUTHOR OF THIS ARTICLE – In hopes I won’t ever have to recreate my 25 network shortcuts again. (I had taken to storing them in a zip file so I can put them back with less of a pain.)

  3. Kevin Brown said on February 10, 2016 at 2:21 am

    I hate Microsoft. And this is the *default* behavior. So much for alpha and beta testing before release to the public.

    I did the regedit keys additions. Hopefully that works. I only skimmed most of what’s here.

  4. n8lbv said on January 11, 2015 at 4:10 pm

    It’s been YEARS and no fix from Microsoft.

    I’ve tried the hotfox and it does nothing whatsoever. Icons disappear every week on people’s computers. There are NO broken links and frequently used shortcuts keep going away. This is total crap.

    1. Tim Bailen said on January 26, 2016 at 8:20 pm

      n8lbv — did you also set the necessary reg keys? You have to install the hotfix and then configure what you want it to do by setting the reg keys described in the hotfix article:

  5. luke said on February 2, 2014 at 7:48 am

    Just scripted as per the post, let’s see if it works.
    However, another easy fix to go around the problem is to drag your shortcuts in the windows explorer “favorites” folder. They won’t be deleted.

  6. Ab said on May 7, 2013 at 8:19 am
  7. bob said on February 16, 2013 at 6:29 pm

    about a year ago I manually changed the TS_BrokenShortcuts.ps1 to say GT 999 on my computer and another person’s computer.

    A year later that coworker complained again and I discovered that both computers were back to saying GT 4. Clearly windows update restored the disgusting MS code.

    So, today I used the script from jasofbass and put it into my sbs 2003 login script.
    The login script already runs as administrator, so I also removed the “REMEMBER … ” warning message.

    Now everytime someone logs in, Microsoft’s crappy GT 4 will be replaced with GT 999


    p.s. for those people who don’t have an SBS login script, they can create a shortcut to Win7_icon_fix.bat then right click>properties>shortcut>advanced>run as administrator.

  8. ossie dunstan said on October 26, 2012 at 4:19 pm

    this is not what i paid 5,500 fucking aud for this is a microsoft update conflict and needs to be adressed bye fucking microsoft i am not going to waste my fucking time fixing thier fuck up unless they pay me 4 days left microsoft then i make an appointment with a lawyer sick and fucking tired of ur broken software

  9. Amin said on September 3, 2012 at 10:00 am

    I downloaded windows 7 manager few months ago, and I used the option to make my shortcut icons as normal icon, without that little X indicating that it is a shortcut icon.
    so everything was alright until the free trial expired and my shortcut icons now look really so bad, with a blank white box covering the shortcut icons!
    so is there any idea to fix this plz?

  10. WRXGuy02 said on June 29, 2012 at 9:57 pm

    The disappearing icons issue is a known microsoft “bug” and there is a fix for it as the “Show Desktop Icons” is not usually the case for most.
    This has been fixed by a Microsoft “Fix It” utility or a simple Registry modification if you are comfortable getting in there & adding a couple new values. Here’s the KB article info:

    Broken shortcuts are deleted from the desktop in Windows 7

  11. Dave said on June 1, 2012 at 10:41 pm

    I have similar problems with shortcut icons occasionally disappearing from my desktop. However, they are still actually there if I look in the desktop folder – they just don’t display on my screen anymore. There is plenty of room there, and they were displayed OK there before. Anyone know how I can get ’em back? Of course putting them back on the desktop doesn’t work because they are actually still there – they just don’t display anymore!

    Thanks Dave

    1. Josh said on June 6, 2012 at 6:50 pm

      Dave, I’ve got the exact same problem, and I’m surprised at how little info there is online. In my case, I have one user (out of about 50) who logs into terminal services with a roaming profile. His desktop is completely empty when he logs in, even though the Desktop folder in his profile has them all there.

      If I try adding a file or folder to the desktop, all of the icons will spontaneously reappear. But that’s not a sustainable solution.

      Today I deleted the desktop.ini file from the Desktop folder, and so far I haven’t seen the problem occur, but I have to give it time to make sure it’s fixed for good.

  12. anon said on February 28, 2012 at 5:31 am

    Hotfix links:

    run somethingsomething.reg:

    Windows Registry Editor Version 5.00


  13. Lex said on January 27, 2012 at 1:00 am

    As of Jan. 11, 2012 MS has a hotfix available for this issue:

    1. Martin Brinkmann said on January 27, 2012 at 9:38 am

      Great, thanks Lex for posting the link.

  14. Leo said on July 26, 2011 at 2:19 pm


    can’t take ownership of the file… have to change the folder permission than the file permission… fuck MS . network share folder and icon for network apps keeps disapearing …

  15. Jasofbass said on June 8, 2011 at 6:14 am

    Supplementary to my above post, please be aware that you need to sometimes replace the inverted commas [ ” ] from this webpage when pasting into notepad as they don’t translate.

    Additionally, just in case it wasn’t clear in my last post [sorry guys], once you create the ‘replace.vbs’ file, you need to manually place it in the accessible location for your clients. You can then run the ‘win7_icon_fix.bat’ from the local machine or from a network location (keeping in mind that UAC will step in when running from the network location).


  16. Jasofbass said on June 8, 2011 at 5:11 am

    I have modified AndrewC’s script – thanks Andrew!

    Using a piece of vbscript from I created the below batch file for a single click solution.

    Copy the below into notepad and then save as ‘win7_icon_fix.bat’

    @echo *************************************
    @echo ** REMEMBER : Run as Administrator **
    @echo *************************************
    cd \Windows\diagnostics\scheduled\Maintenance
    takeown /F TS_BrokenShortcuts.ps1
    icacls TS_BrokenShortcuts.ps1 /grant “%USERNAME%”:F
    copy “\\%userdomain%\netlogon\replace.vbs” “%temp%”
    cd %temp%
    cscript replace.vbs “%SystemDrive%\Windows\diagnostics\scheduled\Maintenance\TS_BrokenShortcuts.ps1” “-gt 4” “-gt 99”
    del %temp%\replace.vbs /Q

    You will need to also copy the below into notepad and save as ‘replace.vbs’:

    Const ForReading = 1
    Const ForWriting = 2

    strFileName = Wscript.Arguments(0)
    strOldText = Wscript.Arguments(1)
    strNewText = Wscript.Arguments(2)

    Set objFSO = CreateObject(“Scripting.FileSystemObject”)
    Set objFile = objFSO.OpenTextFile(strFileName, ForReading)

    strText = objFile.ReadAll
    strNewText = Replace(strText, strOldText, strNewText)

    Set objFile = objFSO.OpenTextFile(strFileName, ForWriting)
    objFile.WriteLine strNewText

    According to the batch file I have placed the newly created ‘replace.vbs’ into the domain netlogon directory. You can modify this path to be anywhere accessible to your clients.

    Enjoy :)

  17. Oliver said on April 26, 2011 at 6:01 pm

    hey guys
    I tried to do this workaround but I’m having problems with the console.
    My Username is simply “User”, but when I enter this into the console, it’s not working.
    When I open the console, it says: C:UsersUser>
    Then I add this:
    icacls c:windowsdiagnosticsscheduledmaintenanceTS_BrokenShortcuts.ps1 /grant User:F

    But then I get an Error, telling me that one file failed…
    What I’m I doing wrong?


  18. Mark said on April 2, 2011 at 5:42 am

    I agree, other than that it doesn’t address the fundamental issue for most “casual” PC users but adds an additional burden – the desktop is there for a purpose and they should be able to use it correctly, nothwithstanding what Microsoft thinks. Broken “network” shortcuts that maintenance removes (weekly) is also not an issue if the shortcuts themselves are simply pegged as READ ONLY – then they can’t be deleted by some nefarious process.

  19. Mark Prosser said on April 2, 2011 at 4:10 am

    My EYES!!!. A shortcut to a folder with shortcuts in it is the easiest solution.

    1. Mark said on April 2, 2011 at 5:10 am

      Yip – if you want to always be clicking through :-)

      1. Mark Prosser said on April 2, 2011 at 5:15 am

        I leave the window open on the desktop – big enough to see my 30+ shortcuts in list view. It’s really no drama. Best thing about it is that the shortcut folder is on my NAS meaning I can access them from any computer. :)

        as I said; simple and elegant ;)

  20. Dan Patrick said on March 1, 2011 at 12:29 am

    How about a fix that actually makes the broken-icon deletion function properly. It would look something like this suedo code:

    If network_connection_established then
    If Not_Shell_Folder_Icon_Link then
    Perform Deletion
    Don’t Perform Deletion
    End If
    End If

    1. Mark said on April 2, 2011 at 2:34 am

      I have tried this solution and it didn’t work for me – Windows 7 Home Premium 64bit (OEM) x2 PC’s – new installs that off the bat wouldn’t save shortcuts on the Desktop. This has nothing to do with System Maintenance (and it’s weekly clean-up) but is something completely different. Also if you don’t want items removed (for whatever reason) then I would suggest that the link have its attribute changed to Read Only – then whatever process can’t meddle with it.

      My solution to the disappearing shortcuts/icons after a fresh install of the OS is this:

      (New Zealand)
      V1.00 2 April 2011

      Windows 7 versions

      1. Recently clients have started experiencing “disappearing” icons/shortcuts on their desktops.
      2. This is not an update and/or Service Pack 1 problem but is rather linked to improperly allocated permissions in the operating system and is a matter of poor programming on the part of Microsoft.
      3. To remedy this “issue” we have found that the following procedure(s) rectify the matter.
      PLEASE NOTE THAT THIS SUPPORT IS PROVIDED ON AN “AS IS” BASIS and no warranty as to its effectiveness for your system is implied or given.
      As system changes will be effected to your operating system be aware that it might not work in your instance.

      4. Backup all data prior to commencing with this “fix”. SCANFuture Computer Services accepts no responsibility for lost and/or damaged data should you elect to follow this remedial process.

      THE FIX

      Part A
      (1) Icons/shortcuts are saved in one of three locations
      (a) C:\Users\Default
      (b) C:\Users\Public
      (c) C:\Users\ [or other name that has been allocated]
      Note that item (c) may be repeated if there are multiple user accounts that have been created on your system
      C: \ is the root drive where the OS has been installed – if you have installed your OS to another location, change the information to read X:\ etc where X equals the drive where your OS is installed

      Our experience has shown us that the “issue” is NOT related to items (a) or (c) but rather location (b)

      (2) Double click on C:\Users\Public – we need to access C:\Users\Public\Public Desktop
      If this is not visible then do the following:
      Start > Control Panel > Folder Options > View and under Files and Folders select Hidden files and folders – Show hidden files, folders and drives
      Next click on Apply

      (3) Double click on C:\Users\Public\Public Desktop
      Right click in any open area of the window and select Properties

      (4) In the window that opens go to the Security tab
      In the top of this window you should see SYSTEM, (there might be multiple user accounts depending on the number created on your PC), Administrators and INTERACTIVE

      We are interested in the “main” account
      Highlight it – you will see that the permissions field is blank
      Click on Edit
      In the Permissions for Public Desktop once again highlight the account
      Select Allow > Full Control by clicking on it
      Click on Apply

      Close out of all open windows and back to your desktop

      PART B
      (1) Now that the permissions for have been set we can seek to rebuild the “missing” icons

      (2) Open Computer (the old My Computer)
      Open the C:\Users\Public\Public Desktop folder
      Move and/or resize the window to the right hand side of your monitor so that we can see the Start button and the pop-up when the Start button is clicked on

      Click on Start > All Programs
      Find the application that has a missing icon/shortcut on your desktop
      If it is a single entry, right click and copy – if it is one of multiple entries first click on the folder, then right click on the application you wish to place on the desktop and copy it
      *Now go to the open C:\Users\Public\Public Desktop and paste the link there (the link will also now appear on the desktop)
      Once all items have been pasted to the folder (if there are multiple placements), right click on the Desktop and select Refresh – the icons/shortcuts should still be present – if not go to Part C
      This should resolve the issue of “missing” shortcuts/icons
      Please note that placing icons/shortcuts in the C:\Users\Public\Public Desktop folder makes them visible to anyone using the PC – if you don’t wish to grant access to everyone using the PC for a specific application, file or folder then place it in the C:\Users\ folder which will then only make it available when logged into that account

      PART C
      (1) In isolated cases we have found that some icons/shortcuts still keep disappearing after the above fix has been effected.
      In this event, follow the above instructions and work up to the entry marked with an *
      Once the link has been pasted, right click on the link > Properties then go to the General tab
      On the General tab (at the bottom) select Attributes : Read only
      Click Apply
      Close out of all open windows and back to your desktop
      This should resolve the issue of “missing” shortcuts/icons

      I have read many, many posts and threads that purport to provide a solution (some very complicated) for this problem but I can guarantee you that NONE of them work – I have tried/used every one to no avail – I had to work on solving this problem myself (many late nights) due to the general lack of expertise/knowledge and/or Microsoft support out there.
      The above is a workaround that I have found to work (so far) with PC’s that display this issue of “disappearing” icons/shortcuts. Note that not all PC’s that I have dealt with display this problem – it seems like a potluck issue at time of installation of the OS – not so lucky you if it happens to you.
      The above solution applies to Windows Home Premium 64bit (OEM) versions but there is no reason that it wouldn’t apply to all other versions of Windows 7.
      Why Microsoft hasn’t devised a foolproof built-in way to ensure that this doesn’t happen beats me, but there you have it.
      If you want to keep anything in Windows then change its attributes to Read Only – Windows maintenance and/or any other process that wishes to change/delete/amend it will not be able to do so – this is by far the best solution but clearly is not applicable where items are going to be edited on a regular basis so documents, etc might not be a good choice for this approach.

  21. Mark Prosser said on February 27, 2011 at 5:21 am

    I created a shortcut to a folder on a network drive, then put all my shortcuts in that. It’s a simple and elegant solution.

    Regards, Mark.

  22. Guy Boisvert said on January 11, 2011 at 11:05 pm

    Yeah, we disabled it via GPO because modifying the script may work for some time but revert back to its original state with windows update or other ways.

    GPO Is: Computer Config / Policies / Administrative Templates / System/Troubleshooting and Diagnostics/Scheduled Maintenance –> Configure Scheduled Maintenance Behavior = Disabled.

    We installed ADMX files for Windows 7 on our domain server to get those GPO settings.

    Buggy Power Shell script that doesn’t take into account real world utilisation of Windows. I know about virus shortcut attacks but that’s not the right way to address it!

    1. neeeko said on February 19, 2011 at 12:02 am

      Tried the GPO : failed.
      Tried the script : win

      GPO, please GTFO

  23. Ray Wilkerson said on December 7, 2010 at 7:35 pm

    Did anyone try just disabling desktop cleanup via GPO? I have not had this issue and have been using Windows 7 since it was released. One of the first things Idid was disable desktop cleanup because I feel it is useless. I know there is a setting in GPO for this.

    Wondering if this is changed to force disable that function if it would resolve? From the looks of the solution proposed it should.

  24. Dave said on November 29, 2010 at 12:35 pm

    I have the disppearing icons issue as well:
    1. I backed up the user dir. on the server
    2. remove the workstations from the domain
    3. demoted the DC

    After rebuliding the workstation I restored the the user dir. to the workstations
    including the desktop icons. Everything was perfect till the next morining, the icons where gone. Is this the same issue as above?

  25. Justin Bennett said on July 13, 2010 at 8:11 am

    Just an FYI – Your write up helped me develop a script for automating the patching of the power shell scripts. Thanks soo much!

    The script is published here:


  26. Ken said on April 25, 2010 at 2:38 pm

    Just an update… what I tried did not work. Thankfully I now have up to date copy of my desktop using Fences.

    1. AndrewC said on July 12, 2010 at 7:40 am

      I created the following batch file to help based on the article and comments above. I don’t know whether I need both the takeown and the icacls commands but it works as is for my needs.

      Save the following text with a .BAT filename extension such as C:\BrokenShortcuts.BAT then right click on the file in Explorer and then ‘Run as Administrator’.

      @echo *************************************
      @echo ** REMEMBER : Run as Administrator **
      @echo *************************************
      cd \Windows\diagnostics\scheduled\Maintenance
      takeown /F TS_BrokenShortcuts.ps1
      icacls TS_BrokenShortcuts.ps1 /grant “%USERNAME%”:F
      @echo “”
      @echo **************************************************************
      @echo ** Search for ‘gt 4’ and replace with ‘gt 50’ and then SAVE **
      @echo **************************************************************
      @echo “”
      notepad TS_BrokenShortcuts.ps1

  27. Ken said on April 15, 2010 at 10:33 pm

    I’m not a programmer (or even close) but I noticed that comment lines were started with a # so I instead of deleting lines in the Unused Desktopicons file as noted above I added # # to the beginning of each. If there are problems I can distinguish them from original comments by the extra #. Ran maintenance manually without problems but will have to wait and see what happens when scheduled maintenance runs. Also, I use Fences and have taken a snapshot so should now be able to restore desktop if it is erased. If only I had done that earlier!

  28. G said on April 6, 2010 at 8:05 pm

    Thank you this was very helpful. BTW, I had trouble with the take ownership script but was able to do it by hand with simply:
    C:\Windows\diagnostics\scheduled\Maintenance>takeown /F TS_BrokenShortcuts.ps1

  29. Bill said on March 31, 2010 at 3:47 am

    This is complete BS M$!! What a completely rediculous “feature” and even moreso for the fix. Way to go.

  30. z0iid said on March 30, 2010 at 8:23 pm

    (within the TS_BrokenShortcuts.ps1 file, that is.)

  31. z0iid said on March 30, 2010 at 8:21 pm

    or just search for the substring “-gt 4” and change 4 to…. something absurdly large. shortcuts won’t get deleted, but other maintenance will still occur as scheduled.

    1. neeeko said on February 22, 2011 at 5:10 pm

      Nice one. Tried it with success.
      Not much work etiher.

      Thanks for that “-gt” tip and Kudos to ya.

    2. Lernkurve said on June 7, 2010 at 9:50 am

      Pretty great idea! Thanks.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.