Virtualization Technology News and Information
Article
RSS
CODE: Looking at the GuestOS.ComputerName property

Ben Armstrong offers us a new code snippet to help get the network name of the virtual machine through the COM API.  According to Ben, Virtual Server 2005 R2 SP1 has added a few new bells and whistles to the COM API, one of which is the GuestOS.ComputerName property. 

And he says, the great thing about this is that if you want to automate a process that connects to a virtual machine over the network - and be able to handle random network names - then this will allow you to do it.

Option Explicit 
Dim vs, vm, vmName, vmGuestName
vmName = "Windows NT 4.0 CVS Server"
'Connect to Virtual Server 
Set vs = CreateObject("VirtualServer.Application")
'Connect to VM
Set vm = vs.FindVirtualMachine(vmName)
vmGuestName = vm.GuestOS.ComputerName 
WScript.Echo "The virtual machine " & Chr(34) & vmName & Chr(34)
WScript.Echo "Has a guest operating system configured with a network name of " & Chr(34) & vmGuestName & Chr(34)
As usual, thank Ben for this help by going here to the original post.
Published Friday, July 06, 2007 5:49 AM by David Marshall
Filed under:
Comments
There are no comments for this post.
To post a comment, you must be a registered user. Registration is free and easy! Sign up now!
top25
Calendar
<July 2007>
SuMoTuWeThFrSa
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234