Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static bool restart(DateTimeOffset startZeit, DateTimeOffset aktZeit)
- {
- bool ok = true;
- if (startZeit.AddHours(6) < aktZeit)
- {
- try
- {
- ConsoleColour.SetForeGroundColour(ConsoleColour.ForeGroundColour.Cyan);
- Console.WriteLine("Achtung Zeitlimit erreicht -> RESTART!");
- ConsoleColour.SetForeGroundColour();
- // Restart
- ok = false;
- ProcessStartInfo proc = new ProcessStartInfo();
- proc.UserName = "Worker";
- string pwd = "effaw";
- SecureString password = new SecureString();
- Array.ForEach<char>(pwd.ToCharArray(), item => password.AppendChar(item));
- proc.Password = password;
- proc.FileName = "cmd";
- proc.UseShellExecute = false;
- //proc.WindowStyle = ProcessWindowStyle.Hidden;
- proc.Arguments = "/C shutdown -f -r";
- Process.Start(proc);
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.Message);
- }
- }
- return ok;
- }
Add Comment
Please, Sign In to add comment