【发布时间】:2020-05-09 09:39:47
【问题描述】:
我们可以检查 C# .NET 中每个域控制器上配置的 Dns 转发器吗?找不到任何支持这一点的类。
请帮忙。
【问题讨论】:
标签: c# dns active-directory ldap
我们可以检查 C# .NET 中每个域控制器上配置的 Dns 转发器吗?找不到任何支持这一点的类。
请帮忙。
【问题讨论】:
标签: c# dns active-directory ldap
使用 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();
}
}
【讨论】: