6472333

How Can I Use PSEXEC to Remote Deploy Agents

Discussion created by 6472333 on Aug 27, 2014
Latest reply on Jun 10, 2015 by 7579653
The Microsoft PSEXEC tool (part of the PSTOOLS from SysInternal) is a useful free utility that can help automate the agent deployment across all your computers. The process we'll create will use the PSEXEC tool to login to all the computers in your domain remotely, and run a batch file from the shared network folder.

The batch file will install the agent locally using the silent install option (no user intervention required).

Here is the procedure:

  1. Download the PSEXEC tool from the Microsoft website http://download.sysinternals.com/Files/PsTools.zip

  2. Create a batch file that will check if the agent is already installed, and install the agent.



    Here is an example (copy & paste the batch file):

    @echo off

    REM === Agent already installed?

    IF EXIST " C:\Program Files\SAManage\*.EXE" GOTO END

    REM === Mount a shared folder and copy the agent locally ====

    net use Z: /d

    net use Z: \\"Domain Controller"\netlogon

    COPY Z:\SAManageAgentInstaller.exe C:\*.*

    REM === Installing Agent

    C:\SAManageAgentInstaller.exe /TAG=YOURTAG /force /s /nosplash /debug /server: inventory.SAManage.com

    net use Z: /d

    REM === Script done

    :END

    exit

    -- Note: Please change "Domain Controller" to your domain name, and replace YOURTAG with your company TAG.

  3. Save the batch file to a shared folder on your network (assuming \SERVER\NetLogon as a default). Let's call the batch setupsam.bat. Please note that the path used should be defined as a UNC path.

  4. Open a dos window and launch the PSEXEC Tool:
* Install on all computers currently logged in your domain:

psexec \\* -s \\Server\NetLogon\setupsam.bat

* Install on a single computer:

psexec \\COMPUTER_NAME -s \\Server\NetLogon\setupsam.bat

* Install on all computers using the domain administrator credentials:

psexec \\* -s -u Domain\Administrator -p Password \\Server\NetLogon\setupsam.bat

* Install on specific computers (ALL.TXT is a text file that lists target computer names, one per line), using domain administrator credentials:

psexec @ALL.TXT -s -u Domain\Administrator -p Password \\Server\NetLogon\setupsam.bat

Note: when doing mass deployment on multiple computers, you should monitor the response file to get a list of computers that were not deployed (were not connected when the PSEXEC ran), and run the PSEXEC mutliple times throughout the business hours to make sure all your computers are getting installed. PSEXEC is best used together with the domain logon scripts deployment method.

Following the 80/20 rule, all computers that are currently connected to your domain would get the agent installed using PSEXEC, while the remaining computers would get the agent installed the next time they connect to the domain, using the domain logon script. For additional references: http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

Outcomes