Well, it depends on which SID computer you want (seriously!). There is a SID that uses the local computer for itself ... For this, you just need to get the SID of the local Administrator user and remove "-500" from the end to get the SID of the computer.
In C # on .NET 3.5:
using System; using System.Security.Principal; using System.DirectoryServices; using System.Linq; public static SecurityIdentifier GetComputerSid() { return new SecurityIdentifier((byte[])new DirectoryEntry(string.Format("WinNT://{0},Computer", Environment.MachineName)).Children.Cast<DirectoryEntry>().First().InvokeGet("objectSID"), 0).AccountDomainSid; }
On the other hand, there is a SID that Active Directory uses to identify each member computer of the domain ... The one you retrieve when you receive the SID of the computer account in the domain is the one that ends with a dollar sign.
source share