Programmatically Create DHCP Reservation in C#

扶醉桌前 提交于 2019-12-10 21:05:01

问题


I have been assigned the task of creating an application that takes in a MAC address and creates a DHCP reservation for that MAC address. Is there any API built into .NET to easily accomplish this?


回答1:


When I was writing apps for infrastructure there was a COM library called Dhcpobjs.dll in the Windows 2000 Resource Kit. This could be dynamically loaded by a VBScript using IDispatch like so:

Set DhcpMgr = CreateObject("Dhcp.Manager")

Set DhcpServer = DhcpMgr.Servers.Connect("192.130.1.5")

I'd google [ CreateObject Dhcpobjs.dll ] and see what you get. You'd likely be able to add a reference to this lib from your VS project.

I'm surprised there's no managed library for simple Windows infra management. Also look in the TechNet script gallery on microsoft.com for other useful stuff.

Good luck,

Luke

EDIT: This may be of interest to people working or assigned similar duties:

Linq to Active Directory: http://linqtoad.codeplex.com/



来源:https://stackoverflow.com/questions/1510993/programmatically-create-dhcp-reservation-in-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!