Link to home
Start Free TrialLog in
Avatar of Mose_
Mose_

asked on

Launch program on remote machine

Looking for a code sniplet that will fire an application remotely.  Can anyone provide a sample?  Batch/VBScript/WMIScript preferred, please no external links
Avatar of RNMcLean
RNMcLean

Well, in wunduhs XP there is via a DOS window the command START, and via the PATH option, it can start a prog. on another machine on your local network, but I haven't done much with this, and a colleague has only made a few tests. At the other extreme, you could look to how virii spread :)
Avatar of sirbounty
I always get great results with psexec (http://www.sysinternals.com/Utilities/PsExec.html)

psexec \\RemotePC\C$\Folder\application.exe

or, via vbs:

shell "psexec \\RemotePC\C$\Folder\application.exe"
Then there's the MS way - AT and SOON from the ResKit:

AT:
The AT command schedules commands and programs to run on a computer at      
a specified time and date. The Schedule service must be running to use      
the AT command.
                                                           
AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]                    
AT [\\computername] time [/INTERACTIVE]
    [ /EVERY:date[,...] | /NEXT:date[,...]] "command"

\\computername     Specifies a remote computer. Commands are scheduled on the
                   local computer if this parameter is omitted.            
id                 Is an identification number assigned to a scheduled      
                   command.                                                
/delete            Cancels a scheduled command. If id is omitted, all the
                   scheduled commands on the computer are canceled.
/yes               Used with cancel all jobs command when no further
                   confirmation is desired.
time               Specifies the time when command is to run.
/interactive       Allows the job to interact with the desktop of the user  
                   who is logged on at the time the job runs.
/every:date[,...]  Runs the command on each specified day(s) of the week or
                   month. If date is omitted, the current day of the month
                   is assumed.                                              
/next:date[,...]   Runs the specified command on the next occurrence of the
                   day (for example, next Thursday).  If date is omitted, the
                   current day of the month is assumed.
"command"          Is the Windows NT command, or batch program to be run.




SOON:

---------------------------------------------------------------
SOON  :  Command Scheduling Utility  :  by kevina@microsoft.com
---------------------------------------------------------------

Usage : SOON [\\computername] [delay] [/INTERACTIVE] "command"
   or : SOON /D [/L:n] [/R:n] [/I:{ON|OFF}]

delay : the number of seconds from now when the scheduled job should start.

   /D : modify Default settings and/or display their current values.
   /L : set LocalDelay - default delay for Local jobs - initially 5 seconds.
   /R : set RemoteDelay - default delay for Remote jobs - initially 15 seconds.
   /I : set InteractiveAlways option - initially OFF.

SOON schedules a job to run in the near future, a number of seconds from now.
SOON closely resembles the AT command because SOON simply runs a suitable AT
command. For a details of the other arguments run "AT /?" without the quotes.

Examples : SOON CMD /C C:\JOBS\BATCH.CMD
           SOON 10 CMD /C C:\JOBS\BATCH.CMD
           SOON \\SERVER 60 /C \JOBS\BATCH.CMD
           SOON \\SERVER /INTERACTIVE CMD /C C:\JOBS\BATCH.CMD
           SOON /d /l:2 /r:30 /i:on

Current Settings :     InteractiveAlways = OFF
                    LocalDelay (seconds) = 5
                   RemoteDelay (seconds) = 15
Avatar of Mose_

ASKER

I've tried using psexec, but it never seems to work.  for example, if I wanted to launch outlook on a remote machine:

psexec \\knaus00232\C$\program files\microsoft office\office10\outlook.exe
ASKER CERTIFIED SOLUTION
Avatar of sirbounty
sirbounty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial