BLACK HAT SEC

Programming => C# => Topic started by: Omega on March 14, 2022, 09:46:32 AM

Title: C# Start/Stop Windows Update
Post by: Omega on March 14, 2022, 09:46:32 AM
C# Start/Stop Windows Update


Code
    //START
    try
    {
    ServiceController sc = new ServiceController("wuauserv");
    sc.Start();
    }
    catch (Exception ex)
    {
    MessageBox.Show("service could not be started because of the following _error_:\r\n" + ex);
    }


    //STOP
    try
    {
    ServiceController sc = new ServiceController("wuauserv");
    sc.Stop();
    }
    catch (Exception ex)
    {
    MessageBox.Show("service could not be stopped because of the following _error_:\r\n" + ex);
    }