<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[gOxiA=苏繁=SuFan Blog]]></title> 
<link>https://maytide.net/index.php</link> 
<description><![CDATA[gOxiA,苏繁,sufan,Microsoft MVP]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[gOxiA=苏繁=SuFan Blog]]></copyright>
<item>
<link>https://maytide.net/read.php/1665.htm</link>
<title><![CDATA[[Tips] 为指定的事件日志附加任务以实现自动化处理]]></title> 
<author>gOxiA &lt;sufan_cn@msn.com&gt;</author>
<category><![CDATA[Windows Server]]></category>
<pubDate>Tue, 12 Mar 2013 02:37:12 +0000</pubDate> 
<guid>https://maytide.net/read.php/1665.htm</guid> 
<description>
<![CDATA[ 
	<p><a href="http://goxia.maytide.net/ftpupfiles/IIS--IIS-7.x--32bit-_BF4E/logo-windows-server-2008-r2.png"><img title="clip_image001" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="clip_image001" src="http://goxia.maytide.net/ftpupfiles/3bda42853163_8918/clip_image001.png" width="316" height="44"></a>&nbsp;&nbsp;</p>&nbsp;&nbsp;<p><font color="#fd3f0d" size="4"><strong>为指定的事件日志附加任务以实现自动化处理</strong></font></p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://goxia.maytide.net/" target="_blank">gOxiA</a> 所在公司 IT 环境基于 Windows Small Business Server 2011 Standard（SBS2011Std）构建，与 Branch Office 通过光缆相连，使用 SBS2011Std 提供的 DHCP Service 为整个网络提供 Dynamic IP address。由于 SBS2011Std 的独有特性，当 Branch Office 的员工将未配置好的 Wireless Router 接入网络后，SBS2011Std 的 DHCP Service 就会立刻停止。这是因为 SBS2011Std 检测到网络中有其他提供 DHCP Service 的设备，便会停止自身的 DHCPService，此时当其他员工启动系统后便会发现无法正常访问网络，在事件查看器的系统事件中会记录两条错误事件。IT 管理员要解决该问题，除了要排除掉非法的 DHCP Service 以外，还要登录到 SBS2011Std 上重新启动 DHCP Service。其实我们完全可以利用 Windows 的计划任务功能为事件执行特定的任务，以实现类似问题的自动化处理。</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;下面就以 DHCP Service 故障作为案例与大家分享如何为指定的事件日志附加任务以实现自动化处理。首先确定要附加任务的事件日志，本例选择的是来源：DHCP-Server，事件：1054，内容：该计算机上的 DHCP/BINL 服务即将关闭。原因请参阅以前的事件日志消息。</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;然后鼠标右键点击事件，并选择“将任务附加到此事件…”，如下图所示：</p> <p><a href="http://goxia.maytide.net/ftpupfiles/3bda42853163_8918/1.png"><img title="1" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="1" src="http://goxia.maytide.net/ftpupfiles/3bda42853163_8918/1_thumb.png" width="634" height="358"></a></p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;之后跟随向导创建基本任务，可以使用默认名称也可重新命名，如下图所示：</p> <p><a href="http://goxia.maytide.net/ftpupfiles/3bda42853163_8918/2.png"><img title="2" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="2" src="http://goxia.maytide.net/ftpupfiles/3bda42853163_8918/2_thumb.png" width="614" height="476"></a></p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;确认当日志来自系统，源为 DHCP-Server，事件 ID 为 1054 时执行任务，如下图所示：</p> <p><a href="http://goxia.maytide.net/ftpupfiles/3bda42853163_8918/3.png"><img title="3" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="3" src="http://goxia.maytide.net/ftpupfiles/3bda42853163_8918/3_thumb.png" width="614" height="476"></a></p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;事件附件任务支持“启动程序”、“发送电子邮件”、“显示消息”三个任务，因为本例要执行重启 DHCP Service 的操作，所以这里选择“启动程序”，如下图所示：</p> <p><a href="http://goxia.maytide.net/ftpupfiles/3bda42853163_8918/4.png"><img title="4" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="4" src="http://goxia.maytide.net/ftpupfiles/3bda42853163_8918/4_thumb.png" width="614" height="476"></a></p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;执行启动 DHCP Service 的命令是 net start dhcpserver，所以在“启动程序”设置页面中，指定“程序或脚本”为“C:＼Windows＼System32＼net.exe”，“添加参数”这里写入“start dhcpserver”，点下一步继续。可参考下图：</p> <p><a href="http://goxia.maytide.net/ftpupfiles/3bda42853163_8918/5.png"><img title="5" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="5" src="http://goxia.maytide.net/ftpupfiles/3bda42853163_8918/5_thumb.png" width="614" height="476"></a></p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在“摘要”页面，确认信息，建议复选“当单击“完成”时，打开此任务属性的对话框。”便于之后做进一步的设置以完善此任务。</p> <p><a href="http://goxia.maytide.net/ftpupfiles/3bda42853163_8918/6.png"><img title="6" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="6" src="http://goxia.maytide.net/ftpupfiles/3bda42853163_8918/6_thumb.png" width="614" height="476"></a></p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;由于该事件发生时，IT 管理员并不一定登录在服务器上，所以在任务属性的常规选项卡下选择“不管用户是否登录都要运行”，因为默认开启了 UAC，所以复选“使用最高权限运行”。</p> <p><a href="http://goxia.maytide.net/ftpupfiles/3bda42853163_8918/7.png"><img title="7" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="7" src="http://goxia.maytide.net/ftpupfiles/3bda42853163_8918/7_thumb.png" width="567" height="476"></a></p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;至此，为事件附加任务的操作便完成了。当下次再次出现此事件时，系统便会自动启动 DHCP Service。同理，我们可以根据日常维护工作遇到的事件指定相关的任务或通知，以实现自动化处理。</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;有关任务的安全信息可参考：<a title="http://technet.microsoft.com/zh-cn/library/cc722152(v=WS.10).aspx" href="http://technet.microsoft.com/zh-cn/library/cc722152(v=WS.10).aspx">http://technet.microsoft.com/zh-cn/library/cc722152(v=WS.10).aspx</a></p><br/>Tags - <a href="https://maytide.net/go.php/tags/microsoft/" rel="tag">microsoft</a> , <a href="https://maytide.net/go.php/tags/windows/" rel="tag">windows</a> , <a href="https://maytide.net/go.php/tags/small/" rel="tag">small</a> , <a href="https://maytide.net/go.php/tags/business/" rel="tag">business</a> , <a href="https://maytide.net/go.php/tags/server/" rel="tag">server</a> , <a href="https://maytide.net/go.php/tags/2011/" rel="tag">2011</a> , <a href="https://maytide.net/go.php/tags/standard/" rel="tag">standard</a>
]]>
</description>
</item>
</channel>
</rss>