Some friends here on the Hyper-V team shared a PowerShell 2.0 script for getting a custom KVPS:

# Get Custom KVPs

    [string]$vmName = $(throw "Must specify virtual machine name")

$vm = gwmi -namespace root\virtualization Msvm_ComputerSystem -filter "ElementName='$vmName'"

# Get the associated KVP Exchange component
$kvp = gwmi -namespace root\virtualization `
    -query "Associators of {$vm} where ResultClass=Msvm_KvpExchangeComponent"

# Pull the Guest Exchange Items from XML into a hash
$kvpHash = @{}
    ([xml]("<xml>"+$kvp.GuestExchangeItems+"</xml>")).xml.instance | `
return $kvpHash


For more info on how to use PS cmdlets see:

See also James O’Neil’s New and improved PowerShell Library for Hyper-V. Now with more functions and... documentation!

For all 35 sample Hyper-V PS1 scripts in a zipfile, go to: