Execute a BAT File in a remote machine

Discussion in 'Scripting' started by Juanjillo, Feb 19, 2007.

  1. Juanjillo

    Juanjillo Guest

    Hi,

    I have a bat file in server2.
    I´m on server1 and i want to execute remotly this bat file pp.bat

    I execute a vbs file with this code:

    strComputer = "pc_name"
    Set objWMIService = GetObject ("winmgmts:\\" & strComputer &
    "\root\cimv2")
    errReturn = objWMIService.Create ("c:\pp.bat", Null, Null,
    intProcessID)


    Thank you.
     
    Juanjillo, Feb 19, 2007
    #1
    1. Advertisements

  2. Honestly, the fastest and easiest way to do that is to use PSEXEC and it's
    free.

    --
    Jeffery Hicks
    SAPIEN Technologies - Scripting, Simplified. www.SAPIEN.com
    VBScript & Windows PowerShell Training -
    www.ScriptingTraining.com/classes.asp
    Windows PowerShell? - www.SAPIENPress.com/powershell.asp

    blog: http://blog.SAPIEN.com
    blog: http://jdhitsolutions.blogspot.com
     
    Jeffery Hicks, Feb 20, 2007
    #2
    1. Advertisements

  3. Juanjillo

    Juanjillo Guest

    Thank You very much.
    I try this.

    Best reggards.
     
    Juanjillo, Feb 20, 2007
    #3
  4. Juanjillo

    Juanjillo Guest

    Juanjillo, Feb 23, 2007
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.