SebastianS
SebastianS

Reputation: 91

ItemPropertyValue is not recognized as the name of a cmdlet

Im trying to get key values from my Registry. This code below is working on my machine with Powershell 5.1. But if I try to get it to work in Powershell 4.0 it keeps failing. Does anyone have an idea on how to get it to work on 4.0?

$file = "c:\temp\RegistryValues.txt"

$items = Get-Item "HKLM:\SOFTWARE\WOW6432Node\Test\*"
$items2 = $items | select -ExpandProperty name  

$items2 | % { 

    $i = $(($_).split("\")[-1])
    $j = $(Get-ItemPropertyValue "Registry::$_" -Name 'version')
    $k = $(Get-ItemPropertyValue "Registry::$_\Settings" -Name 'Server')

"$i Version: $j Setting: $k" | add-content $file


}

Error:
enter image description here

Upvotes: 4

Views: 8819

Answers (1)

SebastianS
SebastianS

Reputation: 91

Found the solution for V.4

$j = $((Get-ItemProperty -Path "Registry::$_").Version)
$k = $((Get-ItemProperty -Path "Registry::$_\Settings").Server)

Upvotes: 3

Related Questions