{"id":67193,"date":"2006-06-02T13:08:00","date_gmt":"2006-06-02T13:08:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2006\/06\/02\/how-can-i-configure-the-system-failure-options-on-a-windows-server-2003-computer\/"},"modified":"2006-06-02T13:08:00","modified_gmt":"2006-06-02T13:08:00","slug":"how-can-i-configure-the-system-failure-options-on-a-windows-server-2003-computer","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/how-can-i-configure-the-system-failure-options-on-a-windows-server-2003-computer\/","title":{"rendered":"How Can I Configure the System Failure Options on a Windows Server 2003 Computer?"},"content":{"rendered":"<p><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Question\" border=\"0\" alt=\"Hey, Scripting Guy! Question\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" height=\"34\"> \n<P>Hey, Scripting Guy! How can I configure the system failure options on a Windows Server 2003 computer? I\u2019d like to configure the machine to do a small memory dump, and disable both the sending of an administrative alert and the automatic reboot.<BR><BR>&#8212; JS<\/P><IMG border=\"0\" alt=\"Spacer\" src=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2019\/05\/spacer.gif\" width=\"5\" height=\"5\"><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Answer\" border=\"0\" alt=\"Hey, Scripting Guy! Answer\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" height=\"34\"><A href=\"http:\/\/go.microsoft.com\/fwlink\/?linkid=68779&amp;clcid=0x409\"><IMG class=\"farGraphic\" title=\"Script Center\" border=\"0\" alt=\"Script Center\" align=\"right\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/ad.jpg\" width=\"120\" height=\"288\"><\/A> \n<P>Hey, JS. You know, the Scripting Guys happen to all be in a good mood today, so we\u2019re going to go the extra mile here: not only are we going to show you how to configure system failure options on a Windows Server 2003 computer, but &#8211; for no extra charge &#8211; we\u2019ll show you how to perform this task on a Windows XP computer or <I>even on a Windows 2000 computer<\/I> as well. Let\u2019s see any other daily scripting column beat an offer like <I>that<\/I>!<\/P>\n<P>OK, if you want to get <I>technical<\/I> we\u2019re only making that offer because a script that sets system failure options on a Windows Server 2003 computer can &#8211; without any changes &#8211; do the exact same thing on a Windows XP or Windows 2000 computer as well. But maybe we could all just pretend that the Scripting Guys are doing some extra work out of the goodness of their hearts. <\/P>\n<P>Besides, it\u2019s still more than you get out of any other daily scripting column. Or at least any other daily scripting column found on TechNet.<\/P>\n<P>As far as we know, that is.<\/P>\n<P>But who cares about motivations anyway? After all, our guess is that you just want a script that changes the system failure options:<\/P><PRE class=\"codeSample\">Const SMALL_MEMORY_DUMP = 3<\/p>\n<p>strComputer = &#8220;.&#8221;<\/p>\n<p>Set objWMIService = GetObject(&#8220;winmgmts:\\\\&#8221; &amp; strComputer &amp; &#8220;\\root\\cimv2&#8221;)<\/p>\n<p>Set colRecoveryOptions = objWMIService.ExecQuery _\n    (&#8220;Select * From Win32_OSRecoveryConfiguration&#8221;)<\/p>\n<p>For Each objOption in colRecoveryOptions \n    objOption.DebugInfoType = SMALL_MEMORY_DUMP\n    objOption.AutoReboot = FALSE\n    objOption.SendAdminAlert = FALSE\n    objOption.Put_\nNext\n<\/PRE>\n<P>As you can see, even though this script works on Windows Server 2003 and Windows XP <I>and<\/I> Windows 2000 there really isn\u2019t much to it. We start out by defining a constant named SMALL_MEMORY_DUMP and setting the value to 3; we\u2019ll use this constant to specify how we want to write debugging information in case of a system failure (more popularly known as a \u201cblue screen\u201d). We can configure any of the debugging types shown in the following table:<\/P>\n<TABLE id=\"END\" class=\"dataTable\" cellSpacing=\"0\" cellPadding=\"0\">\n<THEAD><\/THEAD>\n<TBODY>\n<TR class=\"record\" vAlign=\"top\">\n<TD>\n<P class=\"lastInCell\"><B>Value<\/B><\/P><\/TD>\n<TD>\n<P class=\"lastInCell\"><B>Meaning<\/B><\/P><\/TD><\/TR>\n<TR class=\"evenRecord\" vAlign=\"top\">\n<TD>\n<P class=\"lastInCell\">0<\/P><\/TD>\n<TD>\n<P class=\"lastInCell\">None<\/P><\/TD><\/TR>\n<TR class=\"record\" vAlign=\"top\">\n<TD>\n<P class=\"lastInCell\">1<\/P><\/TD>\n<TD>\n<P class=\"lastInCell\">Complete memory dump<\/P><\/TD><\/TR>\n<TR class=\"evenRecord\" vAlign=\"top\">\n<TD>\n<P class=\"lastInCell\">2<\/P><\/TD>\n<TD>\n<P class=\"lastInCell\">Kernel memory dump<\/P><\/TD><\/TR>\n<TR class=\"record\" vAlign=\"top\">\n<TD>\n<P class=\"lastInCell\">3<\/P><\/TD>\n<TD>\n<P class=\"lastInCell\">Small memory dump<\/P><\/TD><\/TR><\/TBODY><\/TABLE>\n<DIV class=\"dataTableBottomMargin\"><\/DIV>\n<P>After defining out constant we connect to the WMI service on the local computer (although, as is the case with almost all WMI scripts, we could also run this script against a remote computer). We then use this line of code to retrieve all the instances of the <B>Win32_OSRecoveryConfiguration<\/B> class, which just happens to be the class used for managing system failure options:<\/P><PRE class=\"codeSample\">Set colRecoveryOptions = objWMIService.ExecQuery _\n    (&#8220;Select * From Win32_OSRecoveryConfiguration&#8221;)\n<\/PRE>\n<P>We should point out that, because we use the <B>ExecQuery<\/B> method, we\u2019ll get back a collection and, because we have a collection, we need to set up a For Each loop to walk through all the items in that collection. However, there\u2019s only one set of system failure options per computer, which means the collection will never have more than one item in it.<\/P>\n<P>Speaking of For Each loops, that\u2019s what we do next: we set up a For Each loop to walk through all the system failure options in the collection. (Again, we\u2019ll have only one such set.) Inside that For Each loop we configure values for three different properties: <B>DebugInfoType<\/B>, <B>AutoReboot<\/B>, and <B>SendAdminAlert<\/B>. That\u2019s what we do here:<\/P><PRE class=\"codeSample\">objOption.DebugInfoType = SMALL_MEMORY_DUMP\nobjOption.AutoReboot = FALSE\nobjOption.SendAdminAlert = FALSE\n<\/PRE>\n<P>That little block of code should be fairly straightforward. We start off by setting the value of the DebugInfoType property to our constant SMALL_MEMORY_DUMP. Because AutoReboot and SendAdminAlert are both Boolean values, we can disable sending an email and automatically rebooting the computer simply by setting these values to False. After configuring the property values we then use this line of code to write the changes back to the computer:<\/P><PRE class=\"codeSample\">objOption.Put_\n<\/PRE>\n<P>Whatever you do don\u2019t leave out that line. The <B>Put_<\/B> method is roughly equivalent to the Save command in Microsoft Word. If you don\u2019t choose the Save command any changes you make in Word aren\u2019t going to be saved. Likewise, if you don\u2019t call the Put_ method any changes you make to WMI property values won\u2019t be saved, either.<\/P>\n<TABLE id=\"EPF\" class=\"dataTable\" cellSpacing=\"0\" cellPadding=\"0\">\n<THEAD><\/THEAD>\n<TBODY>\n<TR class=\"record\" vAlign=\"top\">\n<TD>\n<P><B>Scripting Guys anecdote<\/B>. Right before the <I>Microsoft Windows 2000 Scripting Guide<\/I> went to press, an editor we had at the time ran a spell-check on the entire book and changed every instance of Put_ to Put. We never would have caught the mistake had she not pointed out the fact that we needed to be more careful with our spelling, lest the book end up riddled with errors.<\/P>\n<P>As long as we\u2019re on the subject, we should mention that the<I> Scripting Guide <\/I>actually includes a section on <A href=\"http:\/\/null\/technet\/scriptcenter\/guide\/sas_cpm_zezv.mspx\" target=\"_blank\"><B>managing system failure options<\/B><\/A>. We were going to keep that a secret but, seeing as how we\u2019re feeling so chipper today, well, what the heck.<\/P><\/TD><\/TR><\/TBODY><\/TABLE>\n<DIV class=\"dataTableBottomMargin\"><\/DIV>\n<P>So there you have it, JS; aren\u2019t you glad we were in a good mood today? And trust us, that doesn\u2019t happen very often. For at least one of the Scripting Guys <I>his<\/I> good moods pretty much coincide with the life cycle of the 20-year locust. Fortunately, the other Scripting Guys all respect and admire him anyway, despite his occasional grumpiness.<\/P>\n<P>Or at least he\u2019s pretty <I>sure<\/I> that they respect and admire him. Hey, why wouldn\u2019t they?<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey, Scripting Guy! How can I configure the system failure options on a Windows Server 2003 computer? I\u2019d like to configure the machine to do a small memory dump, and disable both the sending of an administrative alert and the automatic reboot.&#8212; JS Hey, JS. You know, the Scripting Guys happen to all be in [&hellip;]<\/p>\n","protected":false},"author":595,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[16,31,3,4,386,5,6],"class_list":["post-67193","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-desktop-management","tag-operating-system","tag-scripting-guy","tag-scripting-techniques","tag-startup-and-shutdown","tag-vbscript","tag-wmi"],"acf":[],"blog_post_summary":"<p>Hey, Scripting Guy! How can I configure the system failure options on a Windows Server 2003 computer? I\u2019d like to configure the machine to do a small memory dump, and disable both the sending of an administrative alert and the automatic reboot.&#8212; JS Hey, JS. You know, the Scripting Guys happen to all be in [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/67193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/595"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=67193"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/67193\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=67193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=67193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=67193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}