Hyper-V Program Manager
In a previous post (http://blogs.msdn.com/virtual_pc_guy/archive/2005/01/24/359650.aspx) - I discussed how Virtual PC / Virtual Server provide basic information about the host computer in the registry of the guest operating system. Virtual Server extends this concept and allows users to specify custom parameters to be created in the guest operating system. This is a very useful 'one way' communication channel - and is helpful in most situations where you want to run automated processes inside of the virtual machine. Here is a very simple VBScript that takes three command line parameters - and uses them to create a custom entry in the registry of the guest operating system:
' || Script begins'' Connect to Virtual ServerSet virtualServer = CreateObject("VirtualServer.Application") ' Get virtual machine from the first command-line parameterSet vm = virtualServer.FindVirtualMachine(WScript.Arguments(0)) ' Set a registry parameter in the guest operating (where the key name is the' second command-line parameter and the data stored in the key is the third' command-line paramaterResult = vm.GuestOS.SetParameter(WScript.Arguments(1), WScript.Arguments(2))'' || Script ends
' || Script begins'' Connect to Virtual ServerSet virtualServer = CreateObject("VirtualServer.Application")
' Get virtual machine from the first command-line parameterSet vm = virtualServer.FindVirtualMachine(WScript.Arguments(0))
' Set a registry parameter in the guest operating (where the key name is the' second command-line parameter and the data stored in the key is the third' command-line paramaterResult = vm.GuestOS.SetParameter(WScript.Arguments(1), WScript.Arguments(2))'' || Script ends
Once you have done this - you can check the value inside of the guest operating system with this script:
' || Script begins'' Setup constantconst HKEY_LOCAL_MACHINE = &H80000002 ' Setup registry object (this is a single line)Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv") ' Set the key path and values to look atstrKeyPath = "SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters"strValueName1 = WScript.Arguments(0) ' Get the values from the registryoReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName1, dwValue1 ' Display the resultsWScript.Echo "The value for " & WScript.Arguments(0) & " is: " & dwValue1 '' || Script ends
' || Script begins'' Setup constantconst HKEY_LOCAL_MACHINE = &H80000002
' Setup registry object (this is a single line)Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
' Set the key path and values to look atstrKeyPath = "SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters"strValueName1 = WScript.Arguments(0)
' Get the values from the registryoReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName1, dwValue1
' Display the resultsWScript.Echo "The value for " & WScript.Arguments(0) & " is: " & dwValue1 '' || Script ends
The only downside to this technique is that 'vm.GuestOS.SetParameter' can only be called when the virtual machine is actively running and Virtual Machine Additions is loaded.
Cheers,Ben
I'm trying to pass more then 1 argument to a windows xp mode application and it looks like a second parameter can not be added.
This is the command line that works:
vmsal.exe "SVGViewer" "||b5fa4934' "SVG Viewer" f:\pic1.svgz
This command give me an "Incorrect file association." error:
vmsal.exe "SVGViewer" "||b5fa4934' "SVG Viewer" f:\pic1.svgz "DETAIL1"
Is it at all possible to pass additional command line arguments to an Windows XP Mode application?
I can not find any official documentation on vmsal.exe, where can i find any?