Click here to Skip to main content
15,881,797 members
Please Sign up or sign in to vote.
5.00/5 (3 votes)
See more:
Hai,

I am in the need of finding out the last accessed date and time of all the installed software in my machine. Please help me to find out. Thanks in advance.
Posted
Comments
Dima Popov 11-Mar-11 5:17am    
I doubt that it's possible. You can access the list of installed software using the registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall. As you can see it doesn't contain the information you need.
Tarun.K.S 11-Mar-11 9:06am    
But if he could enumerate this list as FileInfo, then using that class, we can get these information. What's your say on this?
Dima Popov 11-Mar-11 11:12am    
There are only uninstallers paths.
Sergey Alexandrovich Kryukov 11-Mar-11 11:25am    
Dima, if you run the applet "Add or Removes Programs" you can change "Sort by" to "Date last used" of "Frequency of use". It means that the required information does exist.

A good question, I'll vote 5.
--SA
Dima Popov 11-Mar-11 15:35pm    
Well, I knew that, but when I add this column in the Control Panel Programs, it's empty for all the programs. I thought that I could get the paths to executables from the registry, but only uninstallers have their paths set (more often it's msiexec.exe). Many programs do not have InstallLocation set, so that's my point. Good answer, but does that really work?

1 solution

This is possible. Here is how:

First, you need to access all the to the file path names for every installed product. Use this Registry key to access the list of executable files:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths


You can access Registry nodes using the class Microsoft.Win32.Registry.

For every child node of this node you will find executable file path name. Look at the properties of some of these files. The system property dialog will show some times, including one under the label "Accessed". Run the application and make sure this time changes to the time you run it. You can retrieve this time programmatically using System.IO.File.GetLastAccessTime or System.IO.File.GetLastAccessTimeUtc.

—SA
 
Share this answer
 
v3
Comments
Espen Harlinn 11-Mar-11 12:17pm    
Reasonable answer, my 5
Sergey Alexandrovich Kryukov 11-Mar-11 12:25pm    
Hope so, thank you, Espen,
--SA
Nuri Ismail 11-Mar-11 12:25pm    
Good reply to this interesting question. 5 :)
Sergey Alexandrovich Kryukov 11-Mar-11 12:26pm    
Thank you, Nuri; it should work.
--SA
Tarun.K.S 11-Mar-11 13:17pm    
Perfect answer 5d!. Exactly what i commented on the question. I should have answered this! damn!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900