Determining Registry Value Data Type

by Aug 29, 2013

PowerShell can read and write Registry keys and values easily, but there is no a built-in way to check the data type of a given value.

To find out the data type of a value, first access the Registry key as usual. Then, use its GetValueKind() method. This example checks the value data type for two Registry values:

$RegKey = Get-Item 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion'
$RegKey.GetValueKind('RegisteredOwner')
$RegKey.GetValueKind('DigitalProductID')

Twitter This Tip! ReTweet this Tip!