Quantcast
Channel: Hyper-V forum
Viewing all articles
Browse latest Browse all 8743

Fetch KVP of VM running on another node

$
0
0

Hello,

I am having a two node cluster running Windows 2008 R2 - Hyper-V Enabled. (Node1, Node2)

Now, when I try fetching the KVP of a VM running on Node2 from Node1 I get a blank response using the below code, but when I try to fetch KVP of VM running on Node1 I get correct results. Why is this behavior or the code needs to be changed ?

Please help.

filter Import-CimXml{
 $CimXml = [Xml]$_
 $CimObj = New-Object -TypeName System.Object
 foreach ($CimProperty in CimXml.SelectNodes("/INSTANCE/PROPERTY")){
    $CimObj | Add-Member -MemberType NoteProperty -Name $CimProperty.NAME -Value $CimProperty.VALUE
 }
$CimObj
}
$Vm = Get-WmiObject -ComputerName Node2 -Namespace root\virtualization -Query "Select * From Msvm_ComputerSystem Where Name='98238ABC-B7ED-499A-A8BE-4E7F32DD3284'"
$Kvp = Get-WmiObject -ComputerName Node2  -Namespace root\virtualization -Query "Associators of {$Vm} Where AssocClass=Msvm_SystemDevice ResultClass=Msvm_KvpExchangeComponent"
$GuestKvp = Get-WmiObject -ComputerName Node2-Namespace root\virtualization -Query "Associators of {$Kvp} Where AssocClass=Msvm_ElementSettingData ResultClass=Msvm_KvpExchangeComponentSettingData"
$GuestKvp.HostExchangeItems | Import-CimXml

Thanks.


Viewing all articles
Browse latest Browse all 8743

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>