Windows下AT命令使用

本文详细介绍了如何在Windows Server 08 R2环境下,通过配置防火墙允许ICMP请求,运行at命令在远程Windows桌面系统上执行卡巴斯基杀毒软件的病毒扫描任务。包括设置防火墙规则、解决访问拒绝问题、配置运行at命令的账号以及使用at命令执行病毒扫描的步骤。

最近由于项目的持续化集成系统在构建完成后,需要将构建出的文件进行病毒扫描,我们选择的杀毒软件是卡巴斯基kav2012。但是由于我们的CI系统使用的是Windows Server 08 R2版本,无法安装kav2012。无奈之下只能选择在另一台机器上面安装Windows桌面系统+kav2012,并且在CI系统的脚本中加入at命令,来达到运程控制桌面系统来进行病毒扫描。

at 命令使用语法如下:
at \\computername time /interactive | /every:date,.../next:date,... command
at \\computername id /delete | /delete/yes

 

首先,需要保证能够通过机器名ping通这台机器,在win7下,需要检查防火墙的设置,可以通过下面这篇文章来设置:(转自http://technet.microsoft.com/en-us/library/cc749323(WS.10).aspx

Nobody Can Ping My Computer

8 out of 13 rated this helpful Rate this topic

Updated: February 18, 2010

Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Vista

A common step in troubleshooting connectivity situations is to use the Ping tool to ping the IP address of the computer to which you are trying to connect. When you ping, you send an ICMP Echo message (also known as an ICMP Echo Request message) and get an ICMP Echo Reply message in response. By default, Windows Firewall does not allow incoming ICMP Echo messages, and therefore the computer cannot send an ICMP Echo Reply in response.

Enabling incoming ICMP Echo messages will allow others to ping your computer. However, it also leaves your computer vulnerable to the types of attacks that use ICMP Echo messages. Therefore, we recommended that you enable the Allow incoming echo request setting temporarily, and then disable it when it is no longer needed.

To enable ICMP Echo messages, create new inbound custom rules to allow ICMPv4 and ICMPv6 Echo Request packets.

To enable ICMP Echo Request for ICMPv4 and ICMPv6
  1. In the Windows Firewall with Advanced Security snap-in, click Inbound Rules in the tree, and click New Rule in the Actions Pane.

  2. Click Custom and click Next.

  3. Click All programs and click Next.

  4. For Protocol type, select ICMPv4.

  5. Click Customize for Internet Control Message Protocol (ICMP) settings.

  6. Click Echo Request, click OK, and then click Next.

  7. Under Which local IP address does this rule match? and for Which remote IP address does this rule match click either Any IP address orThese IP Addresses. If you click These IP addresses, specify the IP addresses and click Add, then click Next.

  8. Click Allow the connection, and then click Next.

  9. Under When does this rule apply?, click the active profile, any or all profiles (Domain, Private, Public) to which you want this rule to apply, and then click Next.

  10. For Name type a name for this rule and for Description an optional description. Click Finish.

  11. Repeat steps for ICMPv6, selecting ICMPv6 for Protocol Type instead of ICMPv4.

If you have active connection security rules, it is also helpful for troubleshooting purposes to exempt ICMP from the IPsec requirements temporarily. To do this, in the Windows Firewall with Advanced Security snap-in, in the Properties dialog box, click the IPsec Settings tab and click Yes to Exempt ICMP from IPsec. This step is only necessary if you have active connection security rules on the computer that you are trying to ping.

 

之后,可以运行at \\computername:

如果出现Access is denied的提示,就需要到这台\\computername的机器上面配置一下运行at的帐号了:

会出现如下对话框来改变运行AT的帐号:

配置好之后,at命令应该可以返回指定机器上面状态为active的job了:

 

好了,下面就可以使用如下at命令来远程控制kav进行病毒扫描了:

C:\Users\Administrator>at \\WIN-SRJUT8CLLUL 17:33 "C:\Program Files\Kaspersky Lab\Kaspersky Anti-Virus 2012\avp.com"   SCAN /RA:C:\ScanReport\log.txt \\DailyBuildHost

其中,SCAN, /RA都是kav的命令行接口avp.com的参数:

 

 

\\DailyBuildHost是持续化集成服务器构建出来,需要进行病毒扫描的路径

 

扫描的log的内容如下:

 

转载于:https://www.cnblogs.com/liupengblog/archive/2012/06/12/2546684.html

at命令的用法 At 列出在指定的时间和日期在计算机上运行的已计划命令或计划命令和程序。必须正在运行“计划”服务才能使用 at 命令at [\\computername] [[id] [/delete] | /delete [/yes]] at [\\computername] time [/interactive] [/every:date[,...]| /next:date[,...]] command 参数 无 如果在没有参数的情况下使用,则 at 列出已计划的命令。 \\computername 指定远程计算机。如果省略该参数,命令将安排在本地计算机。 id 指定指派给已计划命令的识别码。 /delete 取消已计划的命令。如果省略了 id,计算机中已计划的命令将被全部取消。 /yes 当删除已计划的事件时,对系统的查询强制进行肯定的回答。 time 指定运行命令的时间。将时间以 24 小时标记(00:00 [午夜] 到 23:59)的方式表示为小时:分钟。 /interactive 允许作业与在作业运行时登录用户的桌面进行交互。 /every:date[,...] 在每个星期或月的指定日期(例如,每个星期四,或每月的第三天)运行命令。将 date 指定为星期的一天或多天 (M,T,W,Th,F,S,Su),或月的一天或多天(使用 1 到 31 的数字)。用逗号分隔多个日期项。如果省略了 date,将假定为该月的当前日期。 /next:date[,...] 在重复出现下一天(例如,下个星期四)时,运行指定命令将 date 指定为星期的一天或多天 (M,T,W,Th,F,S,Su),或月的一天或多天(使用 1 到 31 的数字)。用逗号分隔多个日期项。如果省略了 date,将假定为该月的当前日期。 command 指定要运行的 Windows 2000 命令、程序(.exe 或 .com 文件)或批处理程序(.bat 或 .cmd 文件)。当命令需要路径作为参数时,请使用绝对路径,也就是从驱动器号开始的整个路径。如果命令远程计算机上,请指定服务器和共享名的 UNC 符号,而不是远程驱动器号。如果命令不是可执行 (.exe) 文件,必须在命令前加上 cmd /c,例如: cmd /c dir > c:\test.out
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值