在C#中以编程方式创建DHCP保留 [英] Programmatically Create DHCP Reservation in C#
问题描述
我被分配了创建一个应用程序的任务,该应用程序需要一个MAC地址并为该MAC地址创建DHCP保留. .NET中是否内置任何API可以轻松实现此目的?
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?
推荐答案
在为基础结构编写应用程序时,Windows 2000 Resource Kit中有一个名为Dhcpobjs.dll的COM库. VBScript可以使用IDispatch来动态加载它,如下所示:
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")
我会用Google [CreateObject Dhcpobjs.dll]进行搜索,然后看看您得到了什么.您可能可以在VS项目中添加对该库的引用.
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.
令我惊讶的是,没有用于简单Windows Infra管理的托管库.另外,请在microsoft.com上的TechNet脚本库中查找其他有用的内容.
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.
祝你好运
卢克
这可能对工作或承担类似职责的人很感兴趣:
This may be of interest to people working or assigned similar duties:
Linq到Active Directory: http://linqtoad.codeplex.com/
Linq to Active Directory: http://linqtoad.codeplex.com/
这篇关于在C#中以编程方式创建DHCP保留的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!