label1.Text = WindowsIdentity.GetCurrent().Name.Split('\\')[1];
label2.Text = WindowsIdentity.GetCurrent().Name.Split('\\')[0];
string userName = WindowsIdentity.GetCurrent().Name.Split('\\')[1];
string machineName = WindowsIdentity.GetCurrent().Name.Split('\\')[0];
PrincipalContext c = new PrincipalContext(ContextType.Machine, machineName);
//Specific User
UserPrincipal uc = UserPrincipal.FindByIdentity(c, "Rashid");
DateTime? LoggedInTime = uc.LastLogon;
//Current LoggedIn User
uc = UserPrincipal.FindByIdentity(c, userName);
DateTime? CurrentUserLoggedInTime = uc.LastLogon;
label3.Text = uc;
This are my steps.