开发者

Remotely installing patches

I need to know how to run a batch script that will go to a shared location on the network, put the user name and password in and run a specified file. I'm not great with scripts and I can't find any coherent answers so far. I'm trying to run software patches on MANY systems and trying to save a little time with either going to each box individually and tossing in the patch disk or using Languard to click each patch (up to 155) individually.

So far I've got the 'net use' command to connect to the share but can't get it to use the user name or password, let alone get it to execute开发者_开发知识库 the patches. Could someone put this in a coherent format please? I am getting alot of the syntax, which is great but they always use extra symbols and asterisks which can be a little confusing. Perhaps an example with example names? Thanks!


PsExec can do what you want

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:\bin\test.exe

src: http://www.governmentsecurity.org/forum/index.php?showtopic=1030

I'm on linux right now so I can't test this.

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


You could schedule the PSEXEC commands on the 70+ machines using scheduled tasks. The command line interface for that is SCHTASKS, so you could schedule them all at once from your administrator machine.

C:\Windows\system32>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 /?
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜