473,287 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

DHCP reservation

Is there any sample code for making a DHCP reservation via C#?

Thanks in advance
Mar 13 '06 #1
5 4744
KarlM,

You can use WMI for this. Using the classes in the System.Management
namespace, you can get the instance of the Win32_NetworkAdapterConfiguration
instance which corresponds to the network adapter that you want to make the
DHCP lease for. You can then call the ReleaseDHCPLease method and the
RenewDHCPLease methods to release and renew the DHCP lease.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"KarlM" <Ma******@newsgroup.nospam> wrote in message
news:ED**********************************@microsof t.com...
Is there any sample code for making a DHCP reservation via C#?

Thanks in advance

Mar 13 '06 #2
Hmm, it just occurs to me now, you are trying to make a reservation on
the DHCP server, right?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"KarlM" <Ma******@newsgroup.nospam> wrote in message
news:ED**********************************@microsof t.com...
Is there any sample code for making a DHCP reservation via C#?

Thanks in advance

Mar 13 '06 #3
Yes, that's right.

"Nicholas Paldino [.NET/C# MVP]" wrote:
Hmm, it just occurs to me now, you are trying to make a reservation on
the DHCP server, right?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"KarlM" <Ma******@newsgroup.nospam> wrote in message
news:ED**********************************@microsof t.com...
Is there any sample code for making a DHCP reservation via C#?

Thanks in advance


Mar 14 '06 #4
Hi Martin,
Welcome to MSDN Newsgroup!

I agreed with Nicholas's point here. WMI is a good solution for issue. I
suggest you can try it first.
If there is any problem and concern, please feel free to let me know. I am
glad to provide further support. Thanks!

Best Regards,

Terry Fei[MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
Thread-Topic: DHCP reservation
thread-index: AcZHPeotv2STz4lhRRmCVoD08Bz22w==
X-WBNR-Posting-Host: 82.141.45.146
From: =?Utf-8?B?S2FybE0=?= <Ma******@newsgroup.nospam>
References: <ED**********************************@microsoft.co m> <u2**************@tk2msftngp13.phx.gbl>Subject: Re: DHCP reservation
Date: Tue, 14 Mar 2006 00:04:27 -0800
Lines: 20
Message-ID: <81**********************************@microsoft.co m>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
Newsgroups: microsoft.public.dotnet.languages.csharp
Path: TK2MSFTNGXA03.phx.gbl
Xref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.languages.csharp:391968
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

Yes, that's right.

"Nicholas Paldino [.NET/C# MVP]" wrote:
Hmm, it just occurs to me now, you are trying to make a reservation on the DHCP server, right?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"KarlM" <Ma******@newsgroup.nospam> wrote in message
news:ED**********************************@microsof t.com...
> Is there any sample code for making a DHCP reservation via C#?
>
> Thanks in advance



Mar 15 '06 #5
Thank you Terry. I can try that too.

""TerryFei"" wrote:
Hi Martin,
Welcome to MSDN Newsgroup!

I agreed with Nicholas's point here. WMI is a good solution for issue. I
suggest you can try it first.
If there is any problem and concern, please feel free to let me know. I am
glad to provide further support. Thanks!

Best Regards,

Terry Fei[MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
Thread-Topic: DHCP reservation
thread-index: AcZHPeotv2STz4lhRRmCVoD08Bz22w==
X-WBNR-Posting-Host: 82.141.45.146
From: =?Utf-8?B?S2FybE0=?= <Ma******@newsgroup.nospam>
References: <ED**********************************@microsoft.co m>

<u2**************@tk2msftngp13.phx.gbl>
Subject: Re: DHCP reservation
Date: Tue, 14 Mar 2006 00:04:27 -0800
Lines: 20
Message-ID: <81**********************************@microsoft.co m>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
Newsgroups: microsoft.public.dotnet.languages.csharp
Path: TK2MSFTNGXA03.phx.gbl
Xref: TK2MSFTNGXA03.phx.gbl microsoft.public.dotnet.languages.csharp:391968
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp

Yes, that's right.

"Nicholas Paldino [.NET/C# MVP]" wrote:
Hmm, it just occurs to me now, you are trying to make a reservation on the DHCP server, right?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"KarlM" <Ma******@newsgroup.nospam> wrote in message
news:ED**********************************@microsof t.com...
> Is there any sample code for making a DHCP reservation via C#?
>
> Thanks in advance


Mar 15 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Leszek Gruszka | last post by:
How to get static IP adresses from DHCP? I haven't seen it anywhere... :(
5
by: Steve | last post by:
Hi Folks, I'm trying to create a c# class to manage a DHCP subnet using the win api (dhcpsapi.dll). Currently I can't even instanciate my class, instead I receive the error:...
2
by: WhatHappend | last post by:
I have converted a .Net 1.0 application to .Net 2.0 and the web service invocations have delay of around 10seconds on each intial access. After the first access subsequent access are fast (After a...
5
by: Richard | last post by:
Hello, I'm working on an application to allow our network team to use a small application to make DHCP reservations on our Microsoft DHCP Server. The problem is you have to use P/Invoke to do...
0
by: GHUM | last post by:
Hello, I need to get a list of active leases on a windows dhcp server. Experts from Microsoft statet: """" A: Go to the Address leases of each scope in the DHCP snap-in and dump the leases...
1
by: Screenbert | last post by:
After finding nothing anywhere in google I am posting this so everyone can benefit by it. The formating is not pretty since I copied it from my word document, but you should benefit by it. ...
0
by: screenbert | last post by:
Managing DHCP Servers using C# They said it was impossible. It couldn't be done. But you can in fact manage DHCP servers using C#. This includes creating and deleting Scopes, SuperScopes,...
0
by: =?Utf-8?B?Sm9ubnlCZWU=?= | last post by:
Hello, I would like to be able to make DHCP reservations on the server using .NET. After a search, I saw little on the subject, but there was a hint that it could be done via WMI. I've looked,...
1
by: =?Utf-8?B?bHVrYXN6amc=?= | last post by:
I'm using dhcp (windows 2003 SP1) on our DC. In dhcp all adresses are excluded we only using reservations. Our routers and switches (cisco and 3com) do not obtain addresses from reservation but PC...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.