示例#1
0
        /// <summary>
        /// Finds the value.
        /// </summary>
        /// <param name="ip">The IP address.</param>
        /// <param name="search">The search.</param>
        /// <returns></returns>
        public override Task <Result> FindValue(string ip, string search)
        {
            var WMI = new WmiManager(ip);

            try
            {
                result = search.ToUpper() switch
                {
                    "SYSTEMNAME" => WMI.FindProperty("Win32_ComputerSystem", new List <string> {
                        "Name"
                    }),
                    "SERIAL" => WMI.FindProperty("Win32_ComputerSystemProduct", new List <string> {
                        "UUID"
                    }),
                    _ => default,
        public ActionResult ServerDetails(int id)
        {
            var s = DbManager.GetServer(id);

            return(View(WmiManager.GetServerInfo(s)));
        }
 public ActionResult Reboot(int id)
 {
     WmiManager.RebootServer(DbManager.GetServer(id));
     return(RedirectToAction("Index"));
 }
 public ActionResult InvokeService(int id, string service, string name)
 {
     WmiManager.InvokeOnService(DbManager.GetServer(id), service, name);
     return(RedirectToAction("ServerDetails", new { id }));
 }