One of my readers, TED has made a suggestion as to a hack fix to the sidebar.exe memory problem (as documented in my blog post Windows sidebar.exe Memory Leak). With some spare time at the moment, I’ve been able to implement his suggestion and confirm it works.
I’ve written a batch script, and confirmed this works in Windows 7 (should work in Windows Vista too). I created a batch file called restart-sidebar.bat, and stored it in c:\users\brendan – contents of the file below:
taskkill /im sidebar.exe /f
echo This script will now sleep momentarily…
TIMEOUT /T 2
echo Starting sidebar.exe now…
The idea is it will kill the process called / task with the image name of, sidebar.exe, forcefully. It will then wait two seconds before starting the process again.
To complete the setup, create a new scheduled task specifying the path to your newly created batch file (mine was c:\users\brendan\restart-sidebar.bat). Run the scheduled task as your own user. I have it scheduled to run once a day at 5pm. I prefer to have it run when I’m not using the computer, more of a scheduled maintenance task that goes on behind the scenes. If you find that’s not enough, schedule it to run a few times a day.
For your information – I’ve encountered on only a few occurrences problems in the past when shutting. The sidebar process has stalled the shutdown procedure and Windows has forcefully killed the process. On login again I’ve lost a few sidebar settings. While I’ve not encountered this running the above batch script, it’s possible you may encounter this. If you’re concerned about it, drop the /f from the taskkill line in the above script (as to not force it) and increase the timeout value from 2, to up to 20 seconds to allow it to safely exit.
Downsides / Cons – I haven’t been able to find something to force the batch file to run in a minimised window (so it pops up and runs as a black command prompt window). This I’m a little bit disappointed with – you could perhaps create a shortcut to the batch file and set the properties on it to start minimised – however I’ve not confirmed this works. – See “Edit 14 May 2011” below which overcomes this problem.
Advantages / Pluses – It’s a simple and easy fix. Avoids the pain of closing all your programs and restarting / logging off. Runs in seconds and doesn’t require administrative privileges to run.
Edit 14 May 2011 – I recently received an interesting email sent via the contact page. Ray, a fellow sysadmin in the trenches, had come up with a beautiful revision to my own code above. Using the below Windows Script in a vbs file (e.g. restart_sidebar.vbs) run on the same scheduled task as above, it accomplishes the restart of the sidebar without any extra windows or user interaction – it runs silently in the background (like a ninja). I’ve tested it for a few days and it runs beautifully. Thanks Ray, and good work!
‘ Author: Ray Flores (email@example.com)
‘ Written May 2011
Set WshShell = WScript.CreateObject(“WScript.Shell”)
WshShell.Run “C:\Windows\System32\taskkill.exe /im sidebar.exe /f”, 0, True
WshShell.Run “C:\Windows\System32\timeout.exe /T 2”, 0, True
WshShell.Run “sidebar.exe”, 0, True
- Windows sidebar.exe Memory Leak
- What is sidebar.exe
- What application pool is using all that CPU?
- Automatically Clean Up Temporary ASP.NET Files
- How to delete ASP.NET temporary files from shared server
- What process is locking this file?
- 2 Reasons Why I Am rolling Back From Windows 8.1 to Windows 7
- Google Chrome and NTLM Auto Login Using Windows Authentication