VMware Communities
PJN
Hot Shot
Hot Shot
Jump to solution

Automatic deployment of VMware Player - net config

Hi,

We have a lab of about 20 PCs running WinXP Pro SP2, each one having 3 hardware NICs. On each of these we need to install VMware Player and configure a bridged network to the correct hardware NIC using vmnetcfg.exe. So far so good.

The tricky bit is that on a regular basis the machines need to be completely wiped and reinstalled from scratch - usually by non-engineers who shouldn't be let loose on the machines to tweak settings. It is planned to use Ghost to install the OS.

I've been looking at the problem for a few days now and have come up with a couple of possible solutions. I would greatly appreciate any advice you could give on them.

  1. Use the silent install option of VMplayer, and run a script to set up the networking. I haven't yet found any definitive command line tool to do this, although vnetlib.exe looks vaguely promising if I could find out the incantations for it, or maybe the 'net' commands (I've seen some very useful stuff posted by DaveP on this forum, and on sanbarrow.com )

  2. The VM will only need one bridged connection so disable the two unused ones while the VM starts up, hope that the VM connects to the 'correct' (only one currently enabled) hardware NIC, then restart the other two hardware NICs (because they are used by other things).

  3. Ghost VMware Player as part of the OS.

I'm leaning towards option 3 (ghost) at the moment although I must admit I am not familiar with Ghost.

Any advice would be useful, even negatives such as 'option 1 won't work' etc. would be great. Other alternatives, especially ones that work Smiley Wink, would be fantastic.

Thanks

Pete.

0 Kudos
1 Solution

Accepted Solutions
continuum
Immortal
Immortal
Jump to solution

You can configure vmware_bridge via vnetlib.

This settings depend on random device-IDs in Windows and are not portable - recently I explained how to do this with cmds and regedit - sorry don't have the time to search for that post ...


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

View solution in original post

0 Kudos
10 Replies
oreeh
Immortal
Immortal
Jump to solution

You can export / import the settings using vnetlib.exe with the following options

vnetlib -- export filename
vnetlib -- import filename

PJN
Hot Shot
Hot Shot
Jump to solution

You can export / import the settings using vnetlib.exe with the following options

vnetlib -- export filename
vnetlib -- import filename

Hi oreeh, thanks for the reply.

Hmmmm... set up the config manually and export the settings, then use import for the automatic setup.... interesting....

I've just run the export and it looks as though it exports the vmnet1 and vmnet8 settings from the registry - there may be some other stuff in there as well, it's hard to tell as it's a binary dump.

I'll try setting up some other virtual adapters and see if the export changes.

Thanks so far,

Pete.

0 Kudos
PJN
Hot Shot
Hot Shot
Jump to solution

I've had a bit more of a play with vnetlib -- import / export this morning and sadly it doesn't appear to do anything with the bridged network connections.

Here are my observations:

  • Bridged networking setups are not exported/imported.

  • New virtual network adapters are exported/imported but on import they do not get started.

  • Importing from a file without a new adapter does not remove the new adapter, i.e. you can't use it to remove unwanted entries.

  • Settings on default virtual network adapters (e.g. vmnet1 subnet) are imported but not applied, i.e. no change in ipconfig output. I guess a reboot would apply it (I didn't try).

  • It appears that vnetlib.exe -- import / export merely reads / writes the registry entries for the virtual network adapters.

  • If you really want to control the virtual network adapters then use vnetlib.exe as described by the link in my original post.

All of this is on a WinXP Pro SP2 host machine.

oreeh, it's a pity it didn't work - I kind of liked the way I could see the whole solution hanging together if it had.

I'm still open to any other suggestions.

Thanks

Pete.

0 Kudos
continuum
Immortal
Immortal
Jump to solution

You can configure vmware_bridge via vnetlib.

This settings depend on random device-IDs in Windows and are not portable - recently I explained how to do this with cmds and regedit - sorry don't have the time to search for that post ...


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
PJN
Hot Shot
Hot Shot
Jump to solution

Hi continuum,

Is this the post you were referring to? Fantastic stuff - I especially like the turning it into an installer bit.

Using the information you've provided I should be able to write something to determine the correct hardware NIC from its IP address (setting those up is someone else's problem) held in the registry for the relevant service and configure vmware_bridge to use it. I've had a look at a representative machine and it all looks feasible.

When we get Ghost I'll have a look at that as well - just in case.

Many thanks to you and oreeh for your help.

Pete.

0 Kudos
continuum
Immortal
Immortal
Jump to solution

Pete - the post I had in mind was much newer - and more useful.

It had some autoit scripts I use to bring up vmware-bridge service after reading the random service-ids ...


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

PJN
Hot Shot
Hot Shot
Jump to solution

oops... ok, change search params... is it this one Bridge VMnet0 to Host NIC with script? (dated 15-Sep-2007) - it is rather more recent and it certainly talks about autoit and bridging, no example scripts though :-(. I couldn't find any others with autoit with you as the author that came as close as that one.

Anyway, I hadn't heard about autoit - it sounds like just what I need - and maybe what the other guys need for setting the rest of each machine up as well :D.

Thanks very much for the followup.

... now off to learn autoit ...

Pete.

0 Kudos
continuum
Immortal
Immortal
Jump to solution

Pete - if you want post details of the task you want to automate at my forum. Explaining something in depth makes more sense there ...

Ulli


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
PJN
Hot Shot
Hot Shot
Jump to solution

Thanks Ulli, I may well do that... I'd like to have a little play first though and see how it goes. autoit looks like fun ;).

Pete.

0 Kudos
PJN
Hot Shot
Hot Shot
Jump to solution

Well, I finally got around to playing with AutoIt last week and in a pretty short time got the script working. Here it is for anyone else who might like to do something similar.

Cheers

Pete.


#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.10.0
 Author:         Pete Norton

 Script Function:
	Set up the VMware Bridge networking to connect to the hardware NIC that matches
	the specified IP address mask.
	
	NOTE that the machine needs a reboot before the settings are recognised by vmnetcfg.exe
	(and possibly the system as a whole - just reboot, you know it makes sense).  This script 
	leaves it up to the user to reboot at some convenient time to themselves.

#ce ----------------------------------------------------------------------------

; the IP address of the NIC we need to find
$ip_addr_mask = "172.1.255.255"

$ip_addr_match = StringSplit ($ip_addr_mask, "255", 1)

; obtain the VMware bridge network interface cards - marking the selected one (if any)

$nics = RegRead ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VMnetBridge\Linkage", "Route")

If $nics = "" Then
;	MsgBox ( 0,"VMware Bridge Settings", "Could not find Registry key - is VMware installed?  Exiting")
    Exit 
EndIf

; split the string to get the individual names
$the_nics = StringSplit ($nics, @LF)

; check the IP address(es) of the each NIC to find a match
$the_nic = ""
For $nic In $the_nics
	; remove the quotes
	$nic = StringTrimLeft ( StringTrimRight ( $nic, 1), 1)
	
	$nic_addr_list = RegRead ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\" & $nic & "\Parameters\Tcpip", "IPAddress")

	If $nic_addr_list <> "" Then
		; found the key - check the value(s)
		$nic_addrs = StringSplit ($nic_addr_list, @LF)
		For $nic_addr In $nic_addrs
			$do_check = StringSplit ($nic_addr, $ip_addr_match[1], 1)
			If $do_check[1] = "" Then
				; found a match at the begining of the address
				$the_nic = $nic
			EndIf
		Next
		
		; create an entry for each NIC
		$VMbridgeKey = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VMnetBridge\Parameters\Adapters\" & $nic
		$success = RegWrite ($VMbridgeKey, "VMnet","REG_DWORD", -1)
		
	EndIf
Next

; select the NIC, if we found one, as the one to use for VMware Bridged connections
If $the_nic <> "" Then
	; indicate not to use the default VMnet (set to 0xffffffff)
	$VMbridgeKey = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VMnetBridge\Parameters"
	$success = RegWrite ($VMbridgeKey, "DefaultVMnet","REG_DWORD", -1)
	
	; select the NIC
	$VMbridgeKey = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VMnetBridge\Parameters\Adapters\" & $the_nic
	$success = RegWrite ($VMbridgeKey, "VMnet","REG_DWORD", 0)
	
EndIf

; uncomment the following line if you want to reboot the machine
;Shutdown (2)


0 Kudos