Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# how to identify a guest account?

In my c# winForm application I have to recognize if a guest account is running the application. Any idea?

like image 956
dubila Avatar asked Jun 17 '10 11:06

dubila


1 Answers

You can check the IsGuest property of the current WindowsIdentity:

if (System.Security.Principal.WindowsIdentity.GetCurrent().IsGuest)
{
    // it's a guest account
}
like image 128
Fredrik Mörk Avatar answered Sep 29 '22 22:09

Fredrik Mörk