I'm trying to verify installation of some items in the registry. I would like to return anything installed in the last 14 days. I'm using this:
Get-ItemProperty HKLM:\Software\Microsoft\Updates\*\* |Select-Object -property PSComputerName, PSChildName, InstalledDate |where {$_.InstalledDate -gt (get-date).adddays(-14).ToString('M/d/yyyy')}
When I have a value present for that timeframe, it works. However, when there is nothing that meets the criteria, it returns the information for everything with an InstalledDate in the path I'm new at this so I'm wondering what am I doing wrong?