首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何确定电脑是否连接到了novell eDirectory或Microsoft ActiveDirectory?

如何确定电脑是否连接到了novell eDirectory或Microsoft ActiveDirectory?
EN

Stack Overflow用户
提问于 2011-05-11 20:40:26
回答 3查看 1.1K关注 0票数 4

我刚刚在我的应用程序中实现了Novell eDirectory。因为我们的应用程序支持微软的ActiveDirectory,所以我想防止像"Novell yes/no“这样的额外配置参数。

那么,有没有其他方法可以知道电脑是连接到微软的ActiveDirectory还是Novell网络上呢?

EN

回答 3

Stack Overflow用户

发布于 2011-05-12 00:48:13

如果你想知道一台计算机是否是Windows域的一部分,你可以获得Win32_NTDomain WMI信息。

在powerShell中,它提供了:

代码语言:javascript
复制
Get-WmiObject Win32_NTDomain
ClientSiteName          : Default-First-Site-Name
DcSiteName              : Default-First-Site-Name
Description             : DOM
DnsForestName           : dom.fr
DomainControllerAddress : \\192.168.183.100
DomainControllerName    : \\WM2008R2ENT
DomainName              : DOM
Roles                   :
Status                  : OK

根据@ScottTx注释进行编辑您也可以使用Win32_ComputerSystem WMI类

代码语言:javascript
复制
PS> (Get-WMIObject Win32_ComputerSystem).PartOfDomain
False

根据C#中的Win32_NTDomain class documentation,你可以通过以下方式获得它:

代码语言:javascript
复制
using System;
using System.Collections.Generic;
using System.Text;

using System.Management;

namespace WMIQuery
{
  class WmiQuery
  {
    static void Main(string[] args)
    {
      ManagementObjectSearcher domainInfos = new ManagementObjectSearcher("select * from WIN32_NTDomain");

      foreach (ManagementObject domainInfo in domainInfos.Get())
      {
        Console.WriteLine("Name : {0}", domainInfo.GetPropertyValue("Name"));
        Console.WriteLine("Computer/domain : {0}", domainInfo.GetPropertyValue("Caption"));
        Console.WriteLine("Domain name : {0}", domainInfo.GetPropertyValue("DomainName"));
        Console.WriteLine("Status : {0}", domainInfo.GetPropertyValue("Status"));
      }

      // Edition according to @ScottTx comment you can also use `Win32_ComputerSystem` WMI class

      ManagementObjectSearcher ComputerInfos = new ManagementObjectSearcher("select * from Win32_ComputerSystem");
      foreach (ManagementObject ComputerInfo in ComputerInfos.Get())
      {
        if ((bool)ComputerInfo.GetPropertyValue("PartOfDomain"))
          Console.WriteLine("This computer is part of domain");
        else
          Console.WriteLine("This computer is not part of domain");
      }
    }
  }
}

添加对System.Management程序集的引用

票数 2
EN

Stack Overflow用户

发布于 2011-05-19 04:45:30

嗯,像“连接到Novell网络”这样的说法比以前模糊了很多。如果使用Novell ( netware )客户端的工作站上的用户登录到Netware服务器或提供类似NCP (Netware核心协议)服务的服务器(例如linux上的OES ),则只有当用户当前登录到Edirectory (NDS)时,才应该存在电子目录中的网络地址属性。

有时,由于客户端有but,如果用户登录,则此属性不存在,但通常您可以使用该属性。另外,用户同时登录到AD和NDS也是完全正常的。此外,根据使用中的配置或Novell产品,也可以将工作站本身记录到NDS。

票数 1
EN

Stack Overflow用户

发布于 2011-05-12 00:36:01

您是如何连接的?通过LDAP?如果是,请查找sAMAccountName,它是Active Directory所特有的。AD中的每个用户和组都将具有该属性(这是必需的)。而在eDirectory中,没有人会拥有它,除非他们奇怪地扩展了eDirectory模式来添加它。

在RootDSE中可能有一些东西将指示哪个是您的源目录。但我现在还不确定有没有很好的例子。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5964390

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档