如何判断计算机是否已加入域?
可能的重复:
如何检测计算机是否已加入域(在 C# 中)?
有没有办法在不使用任何外部 DLL 的情况下判断计算机是否加入域?我不关心域名的名称,只关心它是否被加入......就像一个布尔值。
提前致谢。 担
Possible Duplicate:
How to detect if machine is joined to domain (in C#)?
Is there any way to tell if a computer is joined to a domain or not without using any external DLL's? I dont care about the name of the domain, just if it is joined or not.. like a boolean value.
Thanks in advance.
Dan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
另一个对我有用的解决方案(不在上一篇文章中)是使用 p/Invoke NetWkstaUserGetInfo。
根据您的具体情况,其他帖子的建议将不起作用(跨操作系统返回不同的值)
Another solution that worked for me, not on the previous post, is using p/Invoke NetWkstaUserGetInfo.
Depending on the details of your situation, the other post's suggestions won't work (cross-operating system returns different values)
域名
Environment.UserDomainName
将为您提供来自这样您就不需要外部 dll :)
Environment.UserDomainName
will give you your domain nameFrom MSDN
so you don't need external dll :)