# Get registry object values

**URL:** <https://forums.powershell.org/t/get-registry-object-values/9875>\
**Category:** PowerShell Help\
**Created:** [December 18, 2017, 11:21am UTC](https://forums.powershell.org/t/get-registry-object-values/9875 "2017-12-18T11:21:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![clive](https://avatars.discourse-cdn.com/v4/letter/c/f08c70/32.png) [@clive](https://forums.powershell.org/u/clive)\
**Post date:** [December 18, 2017, 11:21am UTC](https://forums.powershell.org/t/get-registry-object-values/9875/1 "2017-12-18T11:21:51Z")

</div>

I’ve been trying to extract some registry key values and failing miserably.

This is as far as I can get:-

```
$val = @()
$Val = Get-ChildItem "hklm:\SOFTWARE\NetApp\" | Where name -eq "HKEY_LOCAL_MACHINE\SOFTWARE\NetApp\HostUtilities"

Name Property 
---- -------- 
HostUtilities Version : 7.0.5208.722   
                               InstallDir : C:\Program Files\NetApp\Windows Host Utilities\   
                               LogDir : C:\temp\netapp\ 
                               Multipathing : 1
                               Protocols : 3
```

I can’t figure out how to grab the individual values, like InstallDir. Thanks in advance!

Clive

---

<div class="post-metadata">

**Author:** ![richard-siddaway](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@richard-siddaway](https://forums.powershell.org/u/richard-siddaway)\
**Post date:** [December 19, 2017, 7:16am UTC](https://forums.powershell.org/t/get-registry-object-values/9875/2 "2017-12-19T07:16:02Z")

</div>

I don’t have any NetApp applications on my machine but this should help

Look at the PowerShell entries

```
PS> Get-ChildItem -Path 'HKLM:\SOFTWARE\Microsoft\PowerShell\3'

    Hive: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3

Name Property
---- --------
0409 Install : 1
PowerShellEngine ApplicationBase : C:\Windows\System32\WindowsPowerShell\v1.0
                               ConsoleHostAssemblyName : Microsoft.PowerShell.ConsoleHost, Version=3.0.0.0, Culture=neutral,
                               PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=msil
                               ConsoleHostModuleName : C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShell.ConsoleHost.dll
                               PowerShellVersion : 5.1.16299.15
                               PSCompatibleVersion : 1.0, 2.0, 3.0, 4.0, 5.0, 5.1
                               PSPluginWkrModuleName : C:\Windows\System32\WindowsPowerShell\v1.0\system.management.automation.dll
                               RuntimeVersion : v4.0.30319
```

Under the PowerShellEngine you have a bunch of entries but if you use  
Get-ChildItem -Path 'HKLM:\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine'

You get nothing back. You can use get-ItemProperty

```
PS> Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine\' -Name PowerShellVersion

PowerShellVersion : 5.1.16299.15
PSPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine\
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\3
PSChildName : PowerShellEngine
PSDrive : HKLM
PSProvider : Microsoft.PowerShell.Core\Registry
```

---

<div class="post-metadata">

**Author:** ![clive](https://avatars.discourse-cdn.com/v4/letter/c/f08c70/32.png) [@clive](https://forums.powershell.org/u/clive)\
**Post date:** [December 19, 2017, 10:10am UTC](https://forums.powershell.org/t/get-registry-object-values/9875/3 "2017-12-19T10:10:37Z")

</div>

Thanks Richard. Get-ItemProperty is a solution.  
Basic question following on from this is how to output the string value as opposed the @{…}.

```
$str = Invoke-command -computer "JUNO" { Get-ItemProperty -Path 'HKLM:\SOFTWARE\NetApp\HostUtilities' -Name InstallDir } | Select InstallDir

$Str
#output...
@{InstallDir=C:\Program Files\NetApp\Windows Host Utilities\}
```

I’ve tried $Str.ToString() but that doesn’t work.

---

<div class="post-metadata">

**Author:** ![clive](https://avatars.discourse-cdn.com/v4/letter/c/f08c70/32.png) [@clive](https://forums.powershell.org/u/clive)\
**Post date:** [December 19, 2017, 10:25am UTC](https://forums.powershell.org/t/get-registry-object-values/9875/4 "2017-12-19T10:25:16Z")

</div>

It’s ok, I forgot… use Select -ExpandProperty InstallDir.

Thanks Richard, I’m done. 🙂

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:37pm UTC](https://forums.powershell.org/t/get-registry-object-values/9875/5 "2024-05-16T20:37:01Z")

</div>


