c# - Active Directory - c# 中的 DN 转发器
问题描述
我们可以检查 C# .NET 中每个域控制器上配置的 Dns 转发器吗?找不到任何支持这一点的类。
请协助。
解决方案
使用 WSManConnectionInfo 和 Runspace,我可以获取所需的详细信息。
WSManConnectionInfo connInfo = new WSManConnectionInfo(new Uri("http://ServerName:5985/wsman"));
Collection<PSObject> output = null;
string command = "Get-DnsServerForwarder";
using (Runspace remoteRS = RunspaceFactory.CreateRunspace(connInfo))
{
remoteRS.Open();
using (var pShell = PowerShell.Create())
{
pShell.Commands.AddCommand(command);
output = pShell.Invoke();
}
}
推荐阅读
- flutter - googleplaystore 的 Flutter 包名称
- c++ - c++ how to bind a general function with multiple map object and call it clear function
- nhibernate - 自定义 IConnectionProvider 如何“注入”所需的依赖项?
- excel - VBA:单步执行时复制和粘贴范围作为图片工作,但运行时出现“运行时错误'1004'”
- postgresql - 在 postgresql 中是否可以直接读取
- java - Spring Boot 中的现有客户端验证?
- arrays - 有没有办法在 Tarantool 中存储数组的字段上建立索引?
- postscript - 使用过程作为 ReusableStreamDecode 过滤器的数据源
- sorting - 地图中除数的最佳重构
- html - 尝试更改特定导航栏的格式