简体   繁体   English

在 C# 中以编程方式创建 DHCP 保留

[英]Programmatically Create DHCP Reservation in C#

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.我被分配了创建应用程序的任务,该应用程序接收 MAC 地址并为该 MAC 地址创建 DHCP 保留。 Is there any API built into .NET to easily accomplish this? .NET 中是否有任何 API 可以轻松完成此操作?

When I was writing apps for infrastructure there was a COM library called Dhcpobjs.dll in the Windows 2000 Resource Kit.当我为基础结构编写应用程序时,Windows 2000 Resource Kit 中有一个名为 Dhcpobjs.dll 的 COM 库。 This could be dynamically loaded by a VBScript using IDispatch like so:这可以由 VBScript 使用 IDispatch 动态加载,如下所示:

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.我会谷歌 [ CreateObject Dhcpobjs.dll ] 看看你得到了什么。 You'd likely be able to add a reference to this lib from your VS project.您可能能够从 VS 项目中添加对此库的引用。

I'm surprised there's no managed library for simple Windows infra management.我很惊讶没有用于简单 Windows 基础设施管理的托管库。 Also look in the TechNet script gallery on microsoft.com for other useful stuff.还可以在 microsoft.com 上的 TechNet 脚本库中查找其他有用的内容。

Good luck,祝你好运,

Luke卢克

EDIT: This may be of interest to people working or assigned similar duties:编辑:这可能对工作或分配类似职责的人感兴趣:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM