473,383 Members | 1,803 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,383 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 4755
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.