thespot4sap.com independent sap information
 

get SAP Access - pay monthly

SAP Tutorials    Online SAP Training    SAP CBT's    Forums    SAP Articles    SAP Jobs    Resumes
  SAP Access    SAP Blogs    SAP Books     Links     Vendor Directory     Submit Content    Search
Previous posts in SAP XI
Page 606 of 5524

Hyper-V WMI: KVP Exchange aka Data Exchange (Adding New Items From Parent/Host)

Blogger : MSDN Blogs
All posts : All posts by MSDN Blogs
Category : SAP XI
Blogged date : 2008 Jul 06

I have gotten a ton of questions about the KVP Exchange or Data Exchange Integration Component…  So what is it and how do I use it?  The KVP Integration component allows the guest and host to query and provide information to each via pairs of Key’s and Value’s. The KVP integration component provides some basic Key’s and Value’s for you, I talked about the host accessible ones in a previous post Hyper-V WMI Using PowerShell Scripts – Part 3 (KVP's - Guest OS Version) these include things like the fully qualified name, OS version, Processor Architecture etc…  There are also some guest accessible values that provide some information on the parent (host) such as HostName, PhysicalHostName, PhysicalHostNameFullyQualified, and VirtualMachineName.  These values are located in registry under “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters”.  The other thing you can do via the KVP is write registry key’s from the parent (host) and read guest provided registry key’s from the parent (host).  Today I am going to show how to write key’s from the parent into the guest.

Add-KVP.ps1 Script

The AddKvpItems method returns a WMI Job Object see Hyper-V WMI- Rich Error Messages for Non-Zero ReturnValue (no more 32773, 32768, 32700…) for very helpful method to provide rich error messages.

$ComputerName = "localhost"

$VMManagementService = Get-WmiObject -class "Msvm_VirtualSystemManagementService" -namespace "root\virtualization" -ComputerName $ComputerName
$Vm = Get-WmiObject -Namespace root\virtualization -ComputerName $ComputerName -Query "Select * From Msvm_ComputerSystem Where ElementName='Vista'"
$Kvp = Get-WmiObject -Namespace root\virtualization -ComputerName $ComputerName -Query "Associators of {$Vm} Where AssocClass=Msvm_SystemDevice ResultClass=Msvm_KvpExchangeComponent"

$Msvm_KvpExchangeDataItemPath = "\\$ComputerName\root\virtualization:Msvm_KvpExchangeDataItem"
$Msvm_KvpExchangeDateItem = ([WmiClass]$Msvm_KvpExchangeDataItemPath).CreateInstance()
$Msvm_KvpExchangeDateItem.Name = "Test4"
$Msvm_KvpExchangeDateItem.Data = "Testing"
$Msvm_KvpExchangeDateItem.Source = 0

$VMManagementService.AddKvpItems($Vm, $Msvm_KvpExchangeDateItem.PSBase.GetText(1))

And as you can see I have a new registry entry… (btw 64bit Vista SHWEEET!)

clip_image001

 

 

Taylor Brown
Hyper-V Integration Test Lead
http://blogs.msdn.com/taylorb

clip_image001


Read comments or post a reply to : Hyper-V WMI: KVP Exchange aka Data Exchange (Adding New Items From Parent/Host)
Page 606 of 5524

Newest posts
New Page 1

 

 

About Us   Contact Us   Privacy   Disclaimer   Feedback   Email Discussion   Newsletter  

Copyright © - Independent SAP Information
Learn XML, Guesthouses and B&B's