using Azylee.Core.ProcessUtils; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; namespace Azylee.Core.WindowsUtils.AdminUtils { /// /// Windows 系统账号信息 /// public class WindowsAccountModel { /// /// 域 /// public string Domain { get; set; } /// /// 账号 /// public string UserName { get; set; } /// /// 密码 /// public string Password { get; set; } /// /// 构造函数 /// /// /// /// public WindowsAccountModel(string domain = "", string username = "", string password = "") { Domain = domain; UserName = username; Password = password; } /// /// 验证账号密码正确性 /// public bool Check() { try { Process process = ProcessStarter.NewProcess( exe: "cmd.exe", domain: Domain, username: UserName, password: Password); bool flag = process.Start(); process.Kill(); return flag; } catch { return false; } } /// /// 验证账号密码为管理员账号 /// /// public bool CheckAdmin(string password) { return AdminTool.CheckPassword(password); } } }