Author Posts

April 6, 2017 at 2:37 am

I am trying to get the name and value of each key pair using the following in Powershell v5

$path = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*'
$key = Get-Item $path

$namevalues=$key.getvaluenames() | ForEach-Object {[PSCustomObject] @{name=$_; Value=$key.Getvalue($_)}}

I have become stuck, and would appreciate any assistance to rectify this. I seem to be part of the way there but an issue is getting to corresponding key value out, I can get only as far as the name, but can't get the corresponding value.


April 6, 2017 at 6:09 am

What information would you like to get?
Installed Software?

If you have System Center Configuration Manager (SCCM) in your environment try this

$computer = "LocalHost" 
$namespace = "root\cimv2\sms" 
Get-WmiObject -class SMS_InstalledSoftware -computername $computer -namespace $namespace | out-gridview

April 6, 2017 at 6:15 am

Thanks for that – will check it out, I suffer from over thinking things when Powershell makes it 'easy' – I find this out after banging head for a while.

I put together this which gets me to where I need, interested in getting the uninstall path of installed software as one part of my problems. Should be OK now – Thanks!

$path = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*'
Get-ChildItem -Path $path | Get-ItemProperty | Where-Object{$_.uninstallstring}

April 6, 2017 at 11:57 am

Try this:

Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* |  Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize