Удаленная установка патчей - PullRequest
0 голосов
/ 12 июля 2011

Мне нужно знать, как запустить пакетный скрипт, который перейдет в общую папку в сети, поместит имя пользователя и пароль и запустит указанный файл.Я не очень хорошо разбираюсь в сценариях и пока не могу найти последовательных ответов.Я пытаюсь запускать исправления программного обеспечения на МНОГИХ системах и пытаюсь сэкономить немного времени, либо переходя на каждый ящик по отдельности и добавляя диск с исправлениями, либо используя Languard, чтобы щелкнуть каждое исправление (до 155) по отдельности.

Пока у меня есть команда net use для подключения к общему ресурсу, но я не могу заставить его использовать имя пользователя или пароль, не говоря уже о том, чтобы заставить его выполнять исправления.Может кто-нибудь изложить это в связном формате, пожалуйста?Я получаю много синтаксиса, который великолепен, но они всегда используют дополнительные символы и звездочки, которые могут немного запутать.Возможно, пример с именами примеров?Спасибо!

Ответы [ 2 ]

0 голосов
/ 12 июля 2011

Вы можете запланировать команды PSEXEC на 70+ компьютерах, используя запланированные задачи. Интерфейс командной строки для этого - SCHTASKS, так что вы можете запланировать их все сразу с компьютера администратора.

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 голосов
/ 12 июля 2011

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:\bin\test.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: \\yourserver\user$ && Z:\update.exe && net use Z: /delete"
...