public static bool FinalCheck(string hostIP, string userID, Main f, bool isWmiActive, bool displayTask = false) { HostInfo hostInfoUtil = new HostInfo(); hostInfoUtil.HostIP = hostIP; hostInfoUtil.UserID = userID; bool removalTaskExists try { RemoteTasks remote = new RemoteTasks(hostInfoUtil, f); remote.GetHostInfo(true, false); ADTasks ad = new ADTasks(hostInfoUtil, f); ad.CheckLocale(true); ad.CheckExistingRights(true, false, false); } catch (Exception) { MsgBoxInfo("Failed to complete Final Check"); } if (TargUtilities.QueryTaskScheduler(hostIP, userID)) { removalTaskExists = true; } else { RemoteTasks remote = new RemoteTasks(hostInfoUtil, f); rem } //ADTasks adTasksVerify = new ADTasks(hostInfoUtil,f); //adTasksVerify.CheckLocale(isWmiActive); //adTasksVerify.CheckExistingRights(isWmiActive,false,false); string batchPath = string.Format(@"\\{0}\c$\windows\system32\RemAdmin.bat", hostIP); bool batchRemovalExists = File.Exists(batchPath); bool adminExists = hostInfoUtil.AdminRightsExist; TargUtilities.MsgBoxInfo(string.Format( "Batch Exists: {0}{3}" + " Task Exists: {1}{3}" + "Admin Exists: {2}{3}", batchRemovalExists, removalTaskExists, adminExists, Environment.NewLine)); if (batchRemovalExists && removalTaskExists && adminExists) { return(true); } else { return(false); } }
public static bool IsHostAlive(string hostIP) { Ping ping = new Ping(); try { PingReply reply = ping.Send(hostIP, 2000); if (reply.Status == IPStatus.Success) { return(true); } else { TargUtilities.MsgBoxInfo("Failed to connect to host! Is host online?"); return(false); } } catch (Exception) { TargUtilities.MsgBoxInfo("Failed to connect to host! Is host online?"); return(false); } }