//Find all users Active and Disc on the server
        public static string ImpactedUsers(string ip)
        {
            List <string> UserList = new List <string>();

            //Run Script to Query Users
            MorpheusController.CreateBatchFile("C:\\PSTools\\PSExec.exe \\\\%1 query user /server:%1", scriptPath + @"GetUsers.bat");
            string cmdOutput = MorpheusController.RunBatchFile(scriptPath + @"GetUsers.bat", ip);

            string[] lines          = cmdOutput.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
            string   usersFormatted = "";

            //Go through each line and get the username line
            for (int i = 0; i < lines.Length; i++)
            {
                if (lines[i].Contains("Active") || lines[i].Contains("Disc"))
                {
                    string[] activeUser = lines[i].Split(null);
                    usersFormatted += activeUser[1] + ",";
                }
            }

            //If there are users, format it name,name,name.
            if (usersFormatted.Length > 0)
            {
                return(usersFormatted.Remove(usersFormatted.Length - 1, 1) + ".");
            }
            //else return none if there are no users.
            else
            {
                return("None.");
            }
        }
        //Stop force - Disable-FOLGS
        public static string StopForce(string ip)
        {
            KillALLFO(ip); //kill notepads
            MorpheusController.CreateBatchFile("C:\\PSTools\\psexec.exe \\\\" + ip + " -s -i \"C:\\" + forcePath + "Disable-FOLGS.bat", scriptPath + @"FORCE-OFF.bat");
            MorpheusController.RunBatchFile(scriptPath + @"FORCE-OFF.bat", ip);

            return("");
        }
        public static bool KillALLFO(string ip)
        {
            //Create script to kill notepads
            MorpheusController.CreateBatchFile("taskkill /s %1 /im \"notepad.exe\" /f", scriptPath + @"KillAllFO.bat");

            //Run it
            MorpheusController.RunBatchFile(scriptPath + @"KillAllFO.bat", ip);
            return(true);
        }
Exemplo n.º 4
0
        //We need to know what PID's have been assigned to WAP, because they can NOT be used for Local Area progressives.
        //This data can be found in the Bingo database, progressives table.
        //Progressive Type 102 is WAP (100 = local, 101 is Turboboost)
        //select Bingo.dbo.Progressives.GameOutcomeID from Bingo.dbo.Progressives where Bingo.dbo.Progressives.ProgressiveTypeLookupID = 102;
        public static string GetMultisitePIDsFromServer(string ip)
        {
            string pids = "";

            MorpheusController.CreateBatchFile(@"sqlcmd -S " + ip + @" -d Bingo -E -o " + scriptPath + @"WAPPIDresult.txt -Q ""SELECT GameOutcomeID FROM Progressives WHERE ProgressiveTypeLookupID = 102"" ", scriptPath + @"GetWAPPids.bat");

            //Run the batch file
            try
            {
                MorpheusController.RunBatchFile(scriptPath + @"GetWAPPids.bat", ip);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.StackTrace.ToString());
            }

            //Parse the cmd output and return pids, comma delimited
            //Read WAPPIDresult.txt into a variable
            string[] lines = System.IO.File.ReadAllLines(scriptPath + @"WAPPIDresult.txt");
            //Add desired indexes to the string
            int index = 0;

            foreach (string value in lines)
            {
                if (index > 1 && index < lines.Length - 2)
                {
                    //pidLis.Add(value);
                    //add to the string
                    pids += value + ", ";
                }
                index++;
            }
            //delete last comma
            if (!pids.Equals(""))
            {
                pids = pids.Remove(pids.LastIndexOf(','));
                return(pids);
            }
            else
            {
                pids = " - ERROR connecting to this server: WAP PID query failed as a result.";
                return(pids);
            }
        }
        //Start the force - Enable-FOLGS batch file
        //ISSUE: The LGS cmd window doesnt stay open, which causes LGS service to 'exit'
        //It works fine when running
        public static string StartForce(string ip)
        {
            if (ip != null)
            {
                //Kill notepads
                KillALLFO(ip);
                //Copy force files over to server
                CopyForceFilesToServer(ip);
                //give host file access to mothership
                AppendToHostsFileOnServer(ip);
                //string serverPath = @"C:\hydra\HydraLive\trunk\Scripts\";//Location where the start service bat will end up
                //-s -i flags run as a system user and interactive window, so the LGS window doesn't close unexpectedly
                MorpheusController.CreateBatchFile("C:\\PSTools\\psexec.exe \\\\" + ip + " -s -i \"C:\\" + forcePath + "Enable-FOLGS.bat", scriptPath + @"FORCE-ON.bat");
                MorpheusController.RunBatchFile(scriptPath + @"FORCE-ON.bat", ip);
                //Need to manually run NET START EGSSERVICES
                MorpheusController.CreateBatchFile("NET START EGSSERVICES", scriptPath + @"START-SERVICES.bat");
                //Copy the bat file to server
                CopyStartServiceToServer(ip);
                //Run the file
                MorpheusController.RunBatchFile(scriptPath + @"START-SERVICES.bat", ip);
            }

            return("");
        }