0
如何在程序上检测是否userAccount在本地操作系统中启用或禁用win xp或7(不是活动目录)。在C# 也如何检测userAccount通过是否过期?在C#Detect is userAccount在win xp或7 + C中启用或禁用#
谢谢。
如何在程序上检测是否userAccount在本地操作系统中启用或禁用win xp或7(不是活动目录)。在C# 也如何检测userAccount通过是否过期?在C#Detect is userAccount在win xp或7 + C中启用或禁用#
谢谢。
public static bool IsUserEnable(string username, ContextType type)
{
PrincipalContext context = new PrincipalContext(type);
UserPrincipal user = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, username);
return user.Enabled.Value;
}
调用此方法,如:
IsUserEnable("guest", ContextType.Machine);
你的意思是,在登录窗口的时间? – Sohail
为什么你甚至有这样的账户?这些是域控制器功能。 –
不适用于stanalone应用程序。 –