{"id":493,"date":"2014-07-16T07:00:00","date_gmt":"2014-07-16T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2014\/07\/16\/how-do-i-configure-windows-update-programmatically\/"},"modified":"2014-07-16T07:00:00","modified_gmt":"2014-07-16T07:00:00","slug":"how-do-i-configure-windows-update-programmatically","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20140716-00\/?p=493","title":{"rendered":"How do I configure Windows Update programmatically?"},"content":{"rendered":"<p>\nFirst of all, normal programs shouldn&#8217;t be messing with Windows Update\nconfiguration.\nThat&#8217;s something the user (or the user&#8217;s administrator) decides.\nIf you&#8217;re an IT administrator, then you can\n<a HREF=\"http:\/\/technet.microsoft.com\/en-us\/library\/cc720539%28v=ws.10%29.aspx\">\nuse Group Policy\nto configure Windows Update<\/a>\non your network.\n<\/p>\n<p>\nBut maybe you&#8217;re a special case where the above remarks don&#8217;t apply.\nSay you&#8217;re a data center and all the systems are running inside\nof virtual machines and you don&#8217;t want them installing updates\nor rebooting without your permission,\nso you want to run a script when you set up the image to disable\nupdates.\n<\/p>\n<p>\nYou can use the <code>Microsoft.Update.Auto&shy;Update<\/code>\nobject,\nknown to native code as\n<a HREF=\"http:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/aa385821%28v=vs.85%29.aspx\">\n<code>IAutomatic&shy;Updates<\/code><\/a>.\nHere&#8217;s a script that prints your current update settings:\n<\/p>\n<pre>\nvar AU = new ActiveXObject(\"Microsoft.Update.AutoUpdate\");\nvar Settings = AU.Settings;\nWScript.StdOut.WriteLine(Settings.NotificationLevel);\n<\/pre>\n<p>\nThe notification levels are documented as\n<a HREF=\"http:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/aa385806%28v=vs.85%29.aspx\">\n<code>Automatic&shy;Updates&shy;Notification&shy;Level<\/code><\/a>.\nIf you want to change the notification level, you can update the\nlevel in the Settings object, and then save it.\n<\/p>\n<pre>\nvar AU = new ActiveXObject(\"Microsoft.Update.AutoUpdate\");\nvar Settings = AU.Settings;\nSettings.NotificationLevel = 1; \/\/ aunlDisabled\nSettings.Save();\n<\/pre>\n<p>\nAll the various settings are documented in MSDN,\nthough you have to dig through\n<code>IAutomatic&shy;Updates&shy;Settings<\/code>,\n<code>IAutomatic&shy;Updates&shy;Settings2<\/code>,\nand\n<code>IAutomatic&shy;Updates&shy;Settings3<\/code>\nto find them all.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>First of all, normal programs shouldn&#8217;t be messing with Windows Update configuration. That&#8217;s something the user (or the user&#8217;s administrator) decides. If you&#8217;re an IT administrator, then you can use Group Policy to configure Windows Update on your network. But maybe you&#8217;re a special case where the above remarks don&#8217;t apply. Say you&#8217;re a data [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-493","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>First of all, normal programs shouldn&#8217;t be messing with Windows Update configuration. That&#8217;s something the user (or the user&#8217;s administrator) decides. If you&#8217;re an IT administrator, then you can use Group Policy to configure Windows Update on your network. But maybe you&#8217;re a special case where the above remarks don&#8217;t apply. Say you&#8217;re a data [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/493","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=493"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/493\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}