Task.bat脚本内容
@echo off
for /f "delims=" %%a in (d:\server.txt)【server.txt文件位置】 do (copy /y d:\password.bat \\%%a\d
at \\%%a 12:00 \\%%a\d\password.bat)
执行的操作:
1、 拷贝本地服务器的password.bat脚本到所有服务器上的d盘上(需要事先开启所有服务器的D盘)
2、 在所有服务器上创建计划任务,内容就是password.bat的内容
两种方式任选其一即可。作者: maker0321 时间: 2008-4-2 22:31 还是没有明白Climbing的意思。2种方法是不是都要做成批处理上传到其他服务器来执行?
能不能让其他服务器通过网络来执行服务器A的事先做好的脚本呢?
我在其他服务器通过网络路径来执行服务器A的批处理文件,都要弹出一个交互界面,要点击确定才可以执行。我想这可能是远程服务器不能执行服务器A的脚本的原因吧作者: Climbing 时间: 2008-4-3 08:41 原因我已经解释过了,你自己对照着解决一次。作者: maker0321 时间: 2008-4-3 11:12 Climbing:按照你在二楼的回复。在服务器A上做好一个脚本,共享出来。让其他的服务器来通过共享执行这个脚本。
关键是怎么让其他的服务器来执行这个脚本?是否按照你在5楼的回复?
那按照net use 或者copy,这些命令都是要在其他服务器上执行的。如果我有50台服务器,是不是要在50台服务器上分别执行一下?我想的是能否所有的操作都在服务器A上来执行呢。前提条件已经具备了(所有的服务器用户名和密码相同,但是都不开放默认共享)。如果Climbing觉得问题实在是太弱智了。那可以结贴了。作者: dato 时间: 2008-4-3 12:23 为什么psexec这么好用的工具不用,也许不能满足你的要求吧,它需要
What are the minimum requirements to run PSTools commands
On your target machine check if
it is not running Windows XP Home. Windows XP Home is lacking some of the network functionality required by (most) PSTools commands
(Jerome, I read that you are using WinXP Pro Sp2, so this is not for you, but others reading this.)
the Workstation service is running (check using services.msc)
the Server service is running (check using services.msc)
the Admin$ share is available (check using computer management)
the Windows Network is running and Printer and File Sharing are activated (no need to actually share anything)
Incomming network users authenticate as themselves
To achieve this:
(1) Turn off simple file sharing and thus turn on classical file sharing like on Win2K.
(2) Turn of network users identify as guests and thus turn on network users identify as themselves like on Win2K.
(Please, read how to configure authentication here.)
Note:
Classical Network Authentication requires a non-empty password.
If you have not already done so, assign the user who will logon to \\target a strong password.
(This is recommended for security reasons anyway.)
(Again, Jerome, this is not for you, read your statement about the complex password.)
Check your WinXP firewall settings. By default on WinXP Sp2 the firewall will block any incoming traffice. So it may be necessary to open ports 135 and 445 on your target machine for incoming traffic from your local machine.
As soon as your target machine meets all of the above listed requirements, from your local machine try to execute these commands to your target machine:
net use \\target\Admin$ /user:Administrator
dir \\target\Admin$
net use \\target\Admin$ /delete (only disconnects, does not delete anything.)
If these 3 commands work, then it should be possible to run psexec to \\target as well.
以下是个简单的范例
更改学生端密码.cmd
-----------------------------
for /f "tokens=1,2 delims=/ " %%a in (password.txt) do @psexec \\%%a -u administrator -p onlyedu –c -d run.cmd %%b
-----------------------------
Run.cmd
--------------------------------
net user onlyit "%1"
%windir%\System32\rundll32.exe user32.dll,LockWorkStation
----------------------------------