By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,414 Members | 1,057 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,414 IT Pros & Developers. It's quick & easy.

DHCP reservation

P: n/a
Is there any sample code for making a DHCP reservation via C#?

Thanks in advance
Mar 13 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.