如何判断计算机是否已加入域?

发布于 2024-12-19 17:45:04 字数 289 浏览 0 评论 0原文

可能的重复:
如何检测计算机是否已加入域(在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

空城缀染半城烟沙 2024-12-26 17:45:04

另一个对我有用的解决方案(不在上一篇文章中)是使用 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)

仲春光 2024-12-26 17:45:04

域名

Environment.UserDomainName 将为您提供来自

使用UserDomainName属性获取用户的域名

这样您就不需要外部 dll :)

Environment.UserDomainName will give you your domain name

From MSDN

Use the UserDomainName property to obtain the user's domain name

so you don't need external dll :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文