Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7640253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:37:27+00:00 2026-05-31T08:37:27+00:00

We have a server running a 6 day job that just reset, because Windows

  • 0

We have a server running a 6 day job that just reset, because Windows Update Agent (WUA) automatically rebooted the machine to install updates.

I would like to alter my C# app to warn the user if this setting is on in the future, so we don’t end up suffering from random reboots, which forces a restart of said 6-day job, wasting 4 days of CPU time.

Does any know if it is possible to check within WUA that “Important Updates” is set to “Install updates automatically (recommended)”, within C#?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T08:37:29+00:00Added an answer on May 31, 2026 at 8:37 am

    There is an API for the Windows Update Agent (WUA), its general use is described at:

    Install Windows Update Using C#

    Here is the C# code:

    // See http://techforum4u.com/entry.php/11-Install-Windows-Update-Using-C
    var auc = new WUApiLib.AutomaticUpdatesClass();
    if (auc.Settings.NotificationLevel ==
           AutomaticUpdatesNotificationLevel.aunlScheduledInstallation)
    {
        Console.Write("{0}Warning W20120307-1107. Windows Update Agent (WUA) is capable of rebooting the PC automatically. Recommend switching this off for the duration of this 6-day batch process.\n", NPrefix());
    }
    

    After adding c:\WINDOWS\system32\wuapi.dll, if you get a compile error, see Interop type cannot be embedded.

    Note that this approach will only work on Windows 7, add a try/catch around it to prevent a crash on Windows XP. See the forums for how to get it working on XP (you have to reference WUA version 1, WUA for Windows 7 is version 2).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am running Windows Server 2003 host OS. On that I have Windows Virtual
I have an OLD server running DG/UX that will in the near future be
I have a headless server running Windows Server 2003, and administer it via VNC.
I have a IIS server running on Windows Server 2003. The server hosts multiple
Hey I have a windows server running python CGI scripts and I'm having a
I have the MS-SQL server and some jobs running every day on it. I
I have a server running Gentoo 2.6.12 r6 and I want to run Apache
I have a production server running with the following flag: - XX:+HeapDumpOnOutOfMemoryError Last night
I have a build server running CruiseControl.NET. It works well for the 7 projects
We have SQL Server 2005 running on Win2003/64, and we push it hard. We

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.