Welcome › Forums › General PowerShell Q&A › Working with Registry Properties – NoteProperty
- This topic has 6 replies, 5 voices, and was last updated 1 year, 8 months ago by
Participant.
-
AuthorPosts
-
-
May 1, 2019 at 2:32 pm #154604
Trying to find a version of Vmware software installed on a server. Using the following command to query the server’s registry I get the information needed. I just want two values, the name of the software and the version. This is contained in a noteproperty named property.
This is the command I am using
PowerShell1"","Wow6432Node" | ForEach-Object {Get-ChildItem HKLM:\SOFTWARE\$_\Microsoft\Windows\CurrentVersion\Uninstall\ | ? {($_.GetValue("DisplayName")) -like "*VMware*"}}This is a sample of the output:
PowerShell1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162Hive: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\UninstallName Property---- --------{F32C4E7B-2BF8-4788-8408-824C6 AuthorizedCDFPrefix :896E1BB} Comments : BuildContact :DisplayVersion : 10.3.5.10430147HelpLink :HelpTelephone :InstallDate : 20190314InstallLocation : C:\Program Files\VMware\VMware Tools\InstallSource : C:\Program Files\Common Files\VMware\InstallerCache\ModifyPath : MsiExec.exe /I{F32C4E7B-2BF8-4788-8408-824C6896E1BB}NoRepair : 1Publisher : VMware, Inc.Readme :Size :EstimatedSize : 80288UninstallString : MsiExec.exe /I{F32C4E7B-2BF8-4788-8408-824C6896E1BB}URLInfoAbout :URLUpdateInfo :VersionMajor : 10VersionMinor : 3WindowsInstaller : 1Version : 167968773Language : 1033DisplayName : VMware ToolsHive: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\UninstallName Property---- --------{2E4FAF13-B720-4385-A23C-5C38D AuthorizedCDFPrefix :742D6C6} Comments :Contact :DisplayVersion : 6.5.0.234HelpLink :HelpTelephone :InstallDate : 20180927InstallLocation : E:\Tools\PowerCLI\InstallSource : C:\Users\sa00498\AppData\Local\DownloadedInstallations\vSpherePowerCLI\{49AEB26E-F52E-46C1-9345-6E463CAA115B}\ModifyPath : MsiExec.exe /I{2E4FAF13-B720-4385-A23C-5C38D742D6C6}Publisher : VMware, Inc.Readme :Size :EstimatedSize : 255892UninstallString : MsiExec.exe /I{2E4FAF13-B720-4385-A23C-5C38D742D6C6}URLInfoAbout : http://www.vmware.comURLUpdateInfo :VersionMajor : 6VersionMinor : 5WindowsInstaller : 1Version : 100990976Language : 1033DisplayName : VMware PowerCLIsEstimatedSize2 : 181988How do I get the DisplayName and DisplayVersion from that NoteProperty? I will need to do this against a list of servers, but first I have to figure this step out. Any help is appreciated. And if you could explain why your suggestion works that would be helpful too.
Thanks -
May 1, 2019 at 2:46 pm #154608
I use this
Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall |
ForEach-Object { Get-ItemProperty $_.pspath } |
Where-Object {$_.Displayname -like ‘*citrix*’} |
Select-Object PSChildName, DisplayName, DisplayVersion,UninstallString, PSPath |
Sort-Object PSChildName, DisplayName, DisplayVersion,UninstallString, PSPath |Select-Object DisplayName, DisplayVersion | Format-List -
May 1, 2019 at 2:48 pm #154614
orĀ this
Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall |
ForEach-Object { Get-ItemProperty $_.pspath } |
Where-Object {$_.Displayname -like ‘*citrix*’} |
Select-Object PSChildName, DisplayName, DisplayVersion,UninstallString, PSPath |
Sort-Object PSChildName, DisplayName, DisplayVersion,UninstallString, PSPath | Select-Object -expand DisplayName -
May 1, 2019 at 2:51 pm #154616
You can go straight to get-itemproperty with a wildcard:
PowerShell12345678910111213# estimated size in kb$(get-itemproperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*get-itemproperty HKLM:\SOFTWARE\wow6432node\Microsoft\Windows\CurrentVersion\Uninstall\*) |where displayname -like v* |select DisplayName, DisplayVersion, EstimatedSize, InstallLocation,@{n='PSPath';e={$_.PSPath -replace 'Microsoft.PowerShell.Core\\Registry::HKEY_LOCAL_MACHINE','HKLM:'}} |sort | ftDisplayName DisplayVersion EstimatedSize InstallLocation PSPath----------- -------------- ------------- --------------- ------Vulkan Run Time Libraries 1.0.33.0 1.0.33.0 1700 HKLM:\software\microsoft\windows\currentversion\uninstall\VulkanRT...Vulkan Run Time Libraries 1.0.33.0 1.0.33.0 1700 HKLM:\software\microsoft\windows\currentversion\uninstall\VulkanRT... -
May 1, 2019 at 2:52 pm #154619
Thank you. Works like a charm!
Now I have to look at each line and figure out what is happening under the covers
Much appreciated -
May 1, 2019 at 2:56 pm #154620
The simplest way is to pipe the result into Get-ItemProperty to translate the registry item into a more standard PowerShell object with easily-accessible properties. From there, you can use Select-Object -Property to trim down the properties to just the ones you’re interested in.
PowerShell123456foreach ($item in "","Wow6432Node") {Get-ChildItem "HKLM:\SOFTWARE\$item\Microsoft\Windows\CurrentVersion\Uninstall\" |Get-ItemProperty |Where-Object DisplayName -like "*VMware*" |Select-Object -Property DisplayName, DisplayVersion} -
May 1, 2019 at 3:04 pm #154628PowerShell1234'','Wow6432Node' |ForEach-Object {Get-ItemProperty HKLM:\SOFTWARE\$_\Microsoft\Windows\CurrentVersion\Uninstall\VMware* |Select-Object DisplayName,DisplayVersion}
or
PowerShell12345'','Wow6432Node' |ForEach-Object {Get-ItemProperty HKLM:\SOFTWARE\$_\Microsoft\Windows\CurrentVersion\Uninstall\* |Where-Object -Property DisplayName -like '*VMware*' |Select-Object DisplayName,DisplayVersion}The Get-ItemProperty works better with the registry and get all of the properties of the give path in a readable format. Then you can use Select-Object to output the properties to the console.
pwshliquori
-
-
AuthorPosts
- The topic ‘Working with Registry Properties – NoteProperty’ is closed to new replies.