Reputation: 23
I have this part of code -
$result = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* |
Select-Object DisplayName, Publisher, InstallDate, UnistallString |
Where-Object InstallDate -GT 20180201 |
Where-Object UnistallDate -NotMatch " " |
Sort-Object -Property InstallDate -Descending |
Format-Table –AutoSize
$result
With the result of this command I get an array of objects, but if I try to access in it I get no result.
Example:
$result.UnisistallString
. How can I access in it to get only the attributes of that parameter? Because with that then I need to print on video the name of the program and the unistall path.
Upvotes: 1
Views: 63
Reputation: 58931
You should not use the Format-Table
cmdlet if you need to access the data in your code later. Also you have a typo in your example and the select statement. This should work:
$result = Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* |
Select-Object DisplayName, Publisher, InstallDate, UninstallString |
Where-Object InstallDate -GT 20180201 |
Sort-Object -Property InstallDate -Descending
Now Access it using:
$result.UninstallString
Upvotes: 1