远程安装补丁



我需要知道如何运行批处理脚本,该脚本将转到网络上的共享位置,将用户名和密码放在并运行指定的文件。我不擅长写剧本,到目前为止我找不到任何连贯的答案。我试图在许多系统上运行软件补丁,并试图节省一点时间,要么单独去每个盒子,扔进补丁磁盘,要么使用语言单独点击每个补丁(最多155个)。

到目前为止,我已经有了'net use'命令来连接到共享,但无法让它使用用户名或密码,更不用说让它执行补丁了。谁能把这个用一个连贯的格式说出来?我得到了很多语法,这很好,但他们总是使用额外的符号和星号,这可能有点令人困惑。也许是一个带有示例名称的示例?谢谢!

PsExec可以做你想做的

http://technet.microsoft.com/en-us/sysinternals/bb897553

usage: psexec \computer [-u username [-p password]] [-s] [-c [-f]] [-d] program [arguments]

-u Specifies optional user name for login to remote computer. 
-p Specifies optional password for user name. If you omit this you will be prompted to enter a hidden password. 
-s Run remote process in the System account . 
-c Copy the specified program to the remote system for execution. If you omit this option then the application must be in the system's path on the remote system. 
-f Copy the specified program to the remote system even if the file already exists on the remote system. 
-d Don't wait for application to terminate. Only use this option for non-interactive applications. 
Examples
The following command launches an interactive command prompt on \marklap:
psexec \marklap cmd
This command executes IpConfig on the remote system with the /all switch, and displays the resulting output locally:
psexec \marklap ipconfig /all
This command copies the program test.exe to the remote system and executes it interactively:
psexec \marklap -c test.exe
Specify the full path to a program that is already installed on a remote system if its not on the system's path:
psexec \marklap c:bintest.exe
src: http://www.governmentsecurity.org/forum/index.php?showtopic=1030

我现在在linux上,所以我不能测试这个

for /l %%c in (1,1,254) do start psexec \192.168.1.%%c -d -u administrator -p pass "net use Z: \yourserveruser$ && Z:update.exe && net use Z: /delete"

您可以使用计划任务在70多个机器上调度PSEXEC命令。它的命令行接口是SCHTASKS,因此您可以从管理员机器一次调度它们。

C:Windowssystem32>schtasks /?
SCHTASKS /parameter [arguments]
Description:
    Enables an administrator to create, delete, query, change, run and
    end scheduled tasks on a local or remote system.
Parameter List:
    /Create         Creates a new scheduled task.
    /Delete         Deletes the scheduled task(s).
    /Query          Displays all scheduled tasks.
    /Change         Changes the properties of scheduled task.
    /Run            Runs the scheduled task on demand.
    /End            Stops the currently running scheduled task.
    /ShowSid        Shows the security identifier corresponding to a scheduled task name.
    /?              Displays this help message.
Examples:
    SCHTASKS
    SCHTASKS /?
    SCHTASKS /Run /?
    SCHTASKS /End /?
    SCHTASKS /Create /?
    SCHTASKS /Delete /?
    SCHTASKS /Query  /?
    SCHTASKS /Change /?
    SCHTASKS /ShowSid /?

最新更新