by Lery at 2013-04-03 09:22:17
Hello everyone and thank you very much for taking the time to read my post. Here is the code I’m currently using.by mjolinor at 2013-04-03 09:42:15Get-ChildItem -Path HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall |
Get-ItemProperty |
Select-Object -Property DisplayName
It works great. However, when it runs it has plenty of blank spaces in the output. Is there a way to "filter" out these blank spaces so everything is nicely together in its own row?
Here is what the output looks like
[attachment=0]Untitled.png[/attachment]
One way:by Lery at 2013-04-03 10:16:35
Get-ChildItem -Path HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall |
Get-ItemProperty |
Select-Object -Property DisplayName | where {$.DisplayName}
[quote="mjolinor"]One way:by ArtB0514 at 2013-04-03 10:57:01
Get-ChildItem -Path HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall |
Get-ItemProperty |
Select-Object -Property DisplayName | where {$.DisplayName}
[/quote]
Very good thank you. If I can ask a follow-up question? There is an InstallDate entry in the key that I can get. My code now becomes this:Get-ChildItem -Path HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Select-Object -Property DisplayName, installdate. | where {$.DisplayName}
It works, but the installdate is returned in the following format: 20121108
Is there a way to convert that to say: 11-08-2012?
Not very pretty, but this should work:by Lery at 2013-04-03 12:10:29Get-ChildItem -Path HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where {$
.DisplayName} | Select-Object DisplayName, @{Name='Installed';Expression={"$($.installdate.Substring(4,2))-$($.installdate.Substring(6,2))-$($.installdate.Substring(0,4))"}}
Note that I moved the Where clause to before the Select clause because that will reduce the number of objects that Select will have to process.
[quote="ArtB0514"]Not very pretty, but this should work:Get-ChildItem -Path HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where {$
.DisplayName} | Select-Object DisplayName, @{Name='Installed';Expression={"$($.installdate.Substring(4,2))-$($.installdate.Substring(6,2))-$($_.installdate.Substring(0,4))"}}
Note that I moved the Where clause to before the Select clause because that will reduce the number of objects that Select will have to process.[/quote]
Thank you, this worked perfectly.