I have a single command that I would like to execute on a remote Windows 2003 server.
I have tried wmic, which works, but the only way to display standard output is to redirect it to a local file, then list the local file (kind of clunky).
I have also tried psexec, but that seems to have problems working with Windows 2003 servers (at least its reported that the latest version does -- and older versions are not available).
I was trying to stay away from the Windows rcmd utility because I believe that there is a server component that would need to be installed, and I did not want to provide general command line access to the machine.
Are there any other suggestions for tools or utilities that would allow me to specific commands on a remote machine.
Here's a very simple example that I was using in an attempt to get PsExec to work:
C:\Program Files\SysInternalsSuite>psexec \\remote-svr -i -u MyUsername D:\Public\do.bat PsExec v1.95 - Execute processes remotely Copyright (C) 2001-2009 Mark Russinovich Sysinternals - www.sysinternals.com Password: D:\Public\do.bat exited on remote-svr with error code 1.
My sample do.bat file is trivial and contains just the following line:
copy dg.bmp dg1.bmp
The source file dg.bmp is present on the remote machine, the destination file is not. I do have write access to the remote machine.
When I execute the above PsExec command, the do.bat file does not run (although I do have privileges on the remote server) and I don't get the output to the console that I was expecting. I do like the idea of using PsExec, so if there are any tips on what I might be doing wrong, I would appreciate hearing them.