Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Scripting a DHCP Reservation

7 views
Skip to first unread message

JMD

unread,
Mar 1, 2001, 7:32:32 AM3/1/01
to
How can i made a DHCP reservation by script with wsh, wmi, vb etc....?


Manfred Braun

unread,
Mar 2, 2001, 4:00:23 PM3/2/01
to
Hello Jason,

I read this in the resource kit shortly, but found not a code snippet in
scripting. Do you know a resource/sample???

Best regards,
Manfred Braun

(Private)
Lange Roetterstrasse 7
D68167 Mannheim
Germany

mailto:_mbr...@manfred.mannheim-netz.de
(Remove the anti-spam-underscore to mail me!)


"Jason Kohlhoff" <jwk6_n...@hotmail.com> wrote in message
news:FbCn6.36717$t67.5...@news1.rdc1.il.home.com...
> From the Windows 2000 Pro Resource Kit....
>
> Dhcpobjs.exe: DHCP Objects
>
> Install DHCP Objects now.
>
>
> --------------------------------------------------------------------------
--
> ----
>
> DHCP Objects is an automation object-model library for the Microsoft® DHCP
> server. It allows administrators and developers to write applications and
> scripts to administer a DHCP server remotely. It provides enhanced
> capabilities over Dhcpcmd.exe (a tool included in the Microsoft® Windows®
> 2000 Support Tools), such as the ability to remove a DHCP lease.
>
> DHCP Objects is implemented as an in-process server (DLL) exposing
ActiveX®
> Objects (previously known as OLE Automation objects) as dual COM
interfaces.
> All objects are accessible from advanced automation controllers such as
> Microsoft® Visual C++®, Microsoft® Visual Basic®, and Microsoft® Visual
> J++T, as well as from scripting languages like VBScript and JavaScript
> (provided that the scripting host application provides a way to create
> ActiveX objects). The DHCP objects may be accessed remotely via DCOM or
> Remote Automation, so 16-bit, 32-bit and Web-based applications can use it
> to administer any DHCP server on a given network.
>
> DHCP Objects is not installed by the Windows 2000 Resource Kit setup
> program. Before using this tool, you must install it by running
> Dhcpobjs.exe, a self-extracting executable file. Installed with the tool
is
> Dhcpobjs.chm, an HTML Help file that contains detailed information on how
to
> use the tool.
>
> Jason
>
> "JMD" <da...@esc-marseille.fr> wrote in message
> news:e6vJBukoAHA.1840@tkmsftngp03...

Jason Kohlhoff

unread,
Mar 2, 2001, 7:05:34 PM3/2/01
to
I've never actually had to use the component, but I know there's an html
help file packaged in the dhcpobjs.exe archive. And, it does have very nice
samples in it.

BTW, I wasn't clear about it before, but you must install the Resource Kit
Tools from the CD to have dhcpobjs.exe on your machine.

Jason


"Manfred Braun" <mbr...@manfred.mannheim-netz.de> wrote in message
news:eehTZu1oAHA.320@tkmsftngp05...

Manfred Braun

unread,
Mar 17, 2001, 6:05:46 AM3/17/01
to
Hello Jason,

sorry for beeing so late, but thanks for your reply. I saw the help in the
package, but the samples are not working in scripting. They use all "Set x
As "x.y", so they are all for VB.
I'll use OleView to find out, how to instanciate the object.

Anyway, thanks!
Manfred

"Jason Kohlhoff" <jwk6_n...@hotmail.com> wrote in message

news:izWn6.41873$t67.6...@news1.rdc1.il.home.com...

Jon Salmon

unread,
Mar 27, 2001, 12:30:40 PM3/27/01
to
Here's a sample script I've used:

var oManager = new ActiveXObject( "Dhcp.Manager" );
var oServer = oManager.Servers.Connect( "10.0.0.1" );
var oScope = oServer.Scopes.CreateNew();
oScope.Mask = "255.255.255.0";
oScope.StartAddress = "10.0.1.1";
oScope.EndAddress = "10.0.1.254";
oScope.Name = "User Subnet";
oScope.Comment = "Created Fri Mar 9 07:31:32 CST 2001";
oScope.Active = false;
oScope.Update();
oScope.Options.Add( 51, 604800 );
oScope.Options.Add( 15, "mydomain.com" );
oScope.Active = true;
oScope.Update();
oScope = null;
oServer.Disconnect();
oServer = null;

One note: If you're going against a Windows 2000 DHCP server, DO NOT
try to add reservations using DHCP Objects. There is a bug which will crash
the DHCP Server service. I opted to use the DHCPCMD command-line
utility (available in the Resource Kit) to add reservations.

I wrote to Microsoft on 2/19 about this bug. They replied that DHCP Objects
is intended only for Windows NT, NOT for Windows 2000 and said that
DHCP Objects was not supposed to be included in the Windows 2000
Resource Kit.

Jon

"Manfred Braun" <mbr...@manfred.mannheim-netz.de> wrote in message

news:ug$5aHtrAHA.1444@tkmsftngp03...

0 new messages