talatham
10/27/2016 - 11:57 AM

FUNCTION - WINDOWS - REGISTRY: Useful registry functions.

Various registry functions, such as:

  • Test registry key
  • Create registry key
#Configuration
$registrypath = "HKLM:\Software\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc"
$name = "VDIEnabled"
$value = "1"

# Test that a registry path exists and create a key in the location
if (!(Test-Path $registrypath))
{
    New-Item -Path $registrypath -Force | out-null
    New-ItemProperty -Path $registrypath -Name $name -Value $value -PropertyType DWORD -Force #| out-null
} else {
    New-ItemProperty -Path $registrypath -Name $name -Value $value -PropertyType DWORD -Force #| out-null
}