For Programmers: Free Programming Magazines  


Home > Archive > MSDN > August 2004 > Using WMI to Get Virtual PC Host Name









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Using WMI to Get Virtual PC Host Name
Bill R

2004-08-13, 8:55 pm

I setup servers for our tester & developers, and we have deployed over 50
Virtual PCs running across approximately 30 VPC Hosts.

Is there some way I can get the Host Machine Name for running VPCs, either
by WMI or maybe somewhere in the registry of each Virtual PC?

We are currently planning another development cycle for the next release of
our product, and the number of running VPCs & hosts is going to double if not
triple.

Thank you.
Jonathan Maltz [MS-MVP]

2004-08-13, 8:55 pm

No - they are completely isolated. The guest doesn't know what its host is

--
--Jonathan Maltz [Microsoft MVP - Windows Server - IIS, Virtual PC]
http://www.visualwin.com - A Windows Server 2003 visual, step-by-step
tutorial site :-)
http://vpc.visualwin.com - Does <insert OS name> work on VPC 2004? Find out
here
Only reply by newsgroup. I do not do technical support via email. Any
emails I have not authorized are deleted before I see them.


"Bill R" <BillR@discussions.microsoft.com> wrote in message
news:D6352850-B7A7-4671-BF6E-134D269FA410@microsoft.com...
> I setup servers for our tester & developers, and we have deployed over 50
> Virtual PCs running across approximately 30 VPC Hosts.
>
> Is there some way I can get the Host Machine Name for running VPCs, either
> by WMI or maybe somewhere in the registry of each Virtual PC?
>
> We are currently planning another development cycle for the next release

of
> our product, and the number of running VPCs & hosts is going to double if

not
> triple.
>
> Thank you.



Ronny Ong

2004-08-14, 8:55 pm

Although the Virtual Machine Additions probably knows, there is no
documented API which exposes it.

You can, however, solve the problem another way. Exactly how you would do it
in your environment would depend on a lot of things but below are a couple
of general approaches you could take. I am assuming that your guest OS is
always Windows (otherwise you would not have asked about using WMI).

1. Naming conventions: If your guest images are configured with networking
enabled and bound to the host's physical NIC (which is the default in VPC
2004), then even if you aren't joining the guest machines to a domain, you
must be giving each of them a distinct computer name to avoid "duplicate
name on the network" errors. If so, then your images are not 100%
transportable because you can't simply copy a guest from one host and start
running it on another, unless the first host stops running it, or unless you
rename the guest. Therefore, it should be practical to use a naming
convention for guest machines which indicates the host it's running on. Even
if you only assign 2 alphanumeric characters (0-9 and A-Z) for this purpose,
that would allow for 1,296 possible host IDs. Your program/script running on
the guest would just obtain its own machine name and then do a lookup, based
upon that portion of the name.

2. Standard path on the host containing config file: Configure your guest
images with the Shared Folders feature so that there is a consistent,
permanent drive letter (let's say H: for host) which always maps to C:\VPC.
In the C:\VPC folder of each host, deploy a config file (ini file, xml file,
or just a plain txt file) which contains the host's name. You don't even
have to touch each host machine to deploy this file. You could have a logon
script or startup script generate it, or you could run an ADSI-based script
from a central machine which connects to \\host\c$\vpc to drop the file.




"Bill R" <BillR@discussions.microsoft.com> wrote in message
news:D6352850-B7A7-4671-BF6E-134D269FA410@microsoft.com...
>I setup servers for our tester & developers, and we have deployed over 50
> Virtual PCs running across approximately 30 VPC Hosts.
>
> Is there some way I can get the Host Machine Name for running VPCs, either
> by WMI or maybe somewhere in the registry of each Virtual PC?



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com