Chinaunix首页 | 论坛 | 博客
  • 博客访问: 479157
  • 博文数量: 83
  • 博客积分: 2570
  • 博客等级: 少校
  • 技术积分: 901
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-19 12:05
文章分类

全部博文(83)

文章存档

2012年(1)

2011年(1)

2010年(8)

2009年(14)

2008年(45)

2007年(14)

我的朋友

分类: WINDOWS

2010-06-04 10:57:11

 
建立bat文件,内容如下:
net use "admin" /user:"administrator"
shutdown -s -f -t 20 -m
net use "admin" /user:"administrator"
shutdown -s -f -t 20 -m
 
取消关机命令:
shutdown  -a -m
如果出现:找不到网络路径的问题,需要查看被关主机的远程桌面是否打开(3389端口),还有就是是否有权限。如果还是不对,使用gpedit.msc来修改本地安全策略。
 
以上是批量关闭windows机器
批量关闭linux机器方式如下:
1、安装SecureCRT
2、编写bat文件
D:
cd \Program Files\SecureCRT
SecureCRT.exe /script  d:\login1.vbs
 
3、编写script脚本
#$language = "VBScript"
#$interface = "1.0"
Sub main
crt.screen.synchronous = True
crt.session.Connect("192.168.1.64 /L root /Password xxxxxx")
'登录64
crt.screen.send "/root/tg/test_expect" & chr(13)
crt.screen.synchronous = False
End Sub
4、编写test_expect脚本
#!/usr/bin/expect -f
set timeout 5
spawn ssh
expect "password:"
send "downer\r"
expect "]$"
send "exit\r"
interact
spawn ssh
expect "password:"
send "downer\r"
expect "]$"
send "exit\r"
interact
spawn ssh
expect "password:"
send "downer\r"
expect "]$"
send "exit\r"
interact
su - downer
 
阅读(4608) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~