سؤال

It is easy enough to determine if the user running my C# .NET 4.0 console app is a member of the local Administrators group. I am also trying to determine if it is running under LocalSystem. What is the best way to do that?

هل كانت مفيدة؟

المحلول

WindowsIdentity.GetCurrent().User.IsWellKnown(WellKnownSidType.LocalSystemSid)
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top