下面的代码来自:http://www.eggheadcafe.com/software/aspnet/34259796/how-do-i-get-the-machine.aspx 你还可以参考其他人对于SID的讨论。To get the machine SID in C#, you need NTAccount class and SecurityIdentifier class. They live in System.Security.Principal namespace.The code looks like this:NTAccount account = new NTAccount("DOMAIN", "MACHINE-NAME$"); SecurityIdentifier sid = (SecurityIdentifier)account.Translate(typeof(SecurityIdentifier));// we're done, show the results: Console.WriteLine(account.Value); Console.WriteLine(sid.Value);
下面的代码来自:http://www.eggheadcafe.com/software/aspnet/34259796/how-do-i-get-the-machine.aspx
你还可以参考其他人对于SID的讨论。To get the machine SID in C#, you need NTAccount class and
SecurityIdentifier class. They live in System.Security.Principal namespace.The code looks like this:NTAccount account = new NTAccount("DOMAIN", "MACHINE-NAME$");
SecurityIdentifier sid =
(SecurityIdentifier)account.Translate(typeof(SecurityIdentifier));// we're done, show the results:
Console.WriteLine(account.Value);
Console.WriteLine(sid.Value);