Virtualization Technology News and Information
Article
RSS
Configuring and enabling the Virtual DHCP Server with VBScript

From the desk and blog of Ben Armstrong, the industry's resident Virtual PC Guy over at Microsoft.  Once again, Ben helps out the community with another great script.  This time, he is talking about configuring and enabling the virtual DHCP server under Microsoft's Virtual Server with BLOCKED SCRIPT

Option Explicit
dim vs, vn1
'Connect to Virtual Server
Set vs = CreateObject("VirtualServer.Application")
set vn1 = vs.VirtualNetworks.item(1)
vn1.DHCPVirtualNetworkServer.ConfigureDHCPServer _
         "10.10.0.0", _
         "255.255.0.0", _
         "10.10.0.16", _
         "10.10.255.254", _
         "10.10.0.1"
vn1.DHCPVirtualNetworkServer.ConfigureDHCPLeaseTimes 129600, 64800, 97200
vn1.DHCPVirtualNetworkServer.DefaultGatewayAddress = "10.10.0.2"
vn1.DHCPVirtualNetworkServer.DNSServers = "10.10.0.2"
vn1.DHCPVirtualNetworkServer.WINSServers = "10.10.0.2"
vn1.DHCPVirtualNetworkServer.IsEnabled = true

This script configures and enables the DHCP server on the first virtual network on a server.  Some of the calls here are fairly obvious (DefaultGatewayAddress, DNSServers, WINSServers, etc...) but some are a bit more cryptic.  The three parameters for ConfigureDHCPLeaseTimes are the lease time, lease renewal time and lease rebinding time (all specified in seconds).  The ConfigureDHCPServer call takes parameters of the network address to be used, the subnet mask, the starting IP address for the DHCP server to offer, the ending IP address for the DHCP server to offer and the IP address to be used by the DHCP server.

A couple of key 'gotchas' to be aware of here are that the DHCP server IP address must be below the DHCP range specified.  Also the starting address for the DHCP IP range must be above the first 16 addresses of the network.

Thanks to Ben for continuing to keep us working well with these types of scripts.

Read the original or reply to Ben by going here.  Check out his site for more great information.

Published Friday, March 30, 2007 5:39 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!
Calendar
<March 2007>
SuMoTuWeThFrSa
25262728123
45678910
11121314151617
18192021222324
25262728293031
1234567