2

I am trying to uninstall a program based on the last used/accessed date. I know there is property attribute that shows Accessed date.

How can I get the date programtically in PowerShell, so I can compare it against the requirement.

The only think I know is the DisplayName of the program from HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall.

From there I can get InstallLocation, but I don't know the name of the .exe file, so don't know how to get that.

How can I get the path to .exe file for this program and get the date.

Input = DisplayName OutPut = Accessed Date

once I have the path, I can run

Get-ChildItem "C:\Program Files (x86)\Foxit Software\Foxit Reader\FoxitReader.exe" | select lastaccesstime

LastAccessTime      
--------------      
8/17/2017 3:07:17 PM

FoxitReader is just an example. The logic/code should cover other applications as well like Photoshop.

enter image description here

Omar
  • 180
  • 2
  • 15
  • 2
    That is a file system property that tells you when that file was accessed. It doesn't tell you the last time someone opened that program. – Bill_Stewart Oct 03 '17 at 22:29
  • @Bill_Stewart Oh! I thought they were the same. What I want is last used date of this program. Thanks – Omar Oct 04 '17 at 00:34

0 Answers0