我必须承认其domain accounts
不再有效的笔记本电脑。
由于几个问题,可能会发生无效的域帐户。 大多数情况下,客户端从备份恢复,然后域帐户不再有效
在这种情况下,行为是:
cached credentials
has access to shares
服务器上的has access to shares
和文件(NTLM) Kerberos does not work
访问Kerberos does not work
有没有可能检查电脑帐户的有效性?
有了这个代码,我可以找到invalid computer domain accounts
:
try { string sMyComputer = "MyComputer" Domain computerDomain = Domain.GetComputerDomain(); // may! throw ActiveDirectoryObjectNotFoundException if computer account is invalid string sComputerDomain = computerDomain.Name; NTAccount acc_machine = new NTAccount(sComputerDomain, sMyComputer + "$"); SecurityIdentifier sid = (SecurityIdentifier)acc_machine.Translate(typeof(SecurityIdentifier)); // always throws an SystemException if computer account is invalid } catch { // something is wrong with the account }
编辑:
更正了代码中的错误