i’m trying to check if a reg key exist and then increment a reg key if it does. I confirmed that i can set the registry value if i just put the value in directly. ie putting in the value 3.
$path = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\SharedDLLs"
$psv = Get-ItemProperty -path $path
$value = $psv."c:\windows\system32\test.dll"
if(!(Test-Path $value))
{
Set-ItemProperty -path $path -name $key -Type DWORD -value $value++
}
Else
{
echo "error 1"
}
As administrator, Change
$dllToCheckwith your own value and try this :