2011-07-11 14 views
0

ネットワーク上の共有場所に移動し、ユーザー名とパスワードを入力して指定したファイルを実行するバッチスクリプトの実行方法を知っておく必要があります。私はスクリプトではうまくいかず、これまでのところ一貫した答えが見つかりません。私はたくさんのシステム上でソフトウェアパッチを実行しようとしており、個々のボックスに個別に行ってパッチディスクを投げたり、Languardを使って各パッチ(最大155個)を個別にクリックして少し時間を節約しようとしています。パッチのリモートインストール

これまでのところ、私は共有に接続するための 'net use'コマンドを持っていますが、パッチを実行するためにそれを得るのではなく、ユーザー名またはパスワードを使用することはできません。誰かが一貫した形式でこれを置くことができますか?私は偉大な構文の多くを得ているが、彼らは常に余分な記号やアスタリスクを使用して少し混乱することができます。おそらく例の名前の例?ありがとう!

答えて

0

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" 
+0

恐ろしい情報。私はそれが私が探しているものであるかどうかはわかりません。私は確実にoneiesとtwosiesのためにそれを使用することができますが、70台以上のマシンは私のシステムを駄目にし、パッチを非常に長いプロセスにします。私が念頭に置いていたのは、基本的にリモートマシン上で、共有サーバー(私のボックスではない)からパッチをインストールするように指示するスクリプトを実行することでした。私がしなければならないこの方法は、スクリプトを実行して実行させることです。 基本的に私はポイントAであり、ポイントBでポイントCでファイルを実行したいのですが、どうすればいいですか? – Morgan

+0

私は助けるかもしれない1つのライナーを追加しました –

0

スケジュールされたタスクを使用して70台以上のマシンでPSEXECコマンドをスケジュールすることができます。そのためのコマンドラインインターフェイスは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 /?