We recently looked at reading Registry values. http://itknowledgeexchange.techtarget.com/powershell/reading-registry-values/
Before we can do this we need to be able to work out what subkeys are present for a given Registry key. The WMI StdRegProv class gives us a method for doing this – EnumKeys
$HKLM = 2147483650
$key = "SYSTEM\CurrentControlSet\Services"
$reg = [wmiclass]‘\\.\root\default:StdRegprov’
$subkeys = $reg.EnumKey($HKLM, $key)
Using the HKLM constant and defining a key to investigate we create an instance of StdRegProv and call the EnumKey method. The results are put into the $subkeys variable. The snames property contains the names of the subkeys