April 13, 2007 at 9:59 am
I need to know if there is a way to run xp_cmdshell on my database server but opens up a command window on my fileserver to execute the a bat file on the file server?
I attempted to create a batch file on my file server (dir >testA.bat - saved as Test.bat) and called it from my database server (exec xp_cmdshell \\servername\c$\test.bat). But it opens up a window on my Database server and puts the file there? I know I could use a unc path for the batch file (dir >\\servername\c$\testA.bat) but the "test" is to open the command window from the file server.
Thanks in advance!
JG
April 14, 2007 at 7:52 pm
Are you looking to see an command prompt window on SQL Serve or on the Remote box ??? not possible.
Are you looking to just initiate a batch file from a remote machine ??? possible.
see PsExec at http://www.microsoft.com/technet/sysinternals/utilities/pstools.mspx
April 14, 2007 at 8:08 pm
The command window will always "open" from the server... you can, however, run remote bat files... you just need to pass all file info as a UNC including the result of the DIR command.
If you'd give a few more details about what the .bat file is supposed to do, you just never know... someone might actually be able to come up with a solution that'll make you happy.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 16, 2007 at 5:27 am
If you need to run the batch on regular base, you can run it from a scheduled task.
Moreno
April 16, 2007 at 7:15 am
I came here to say what Amit said. So, seconded on the sysinternals tools.
April 16, 2007 at 11:45 am
Thank you all for your replies. I think I'm going to use the PSEXec utility. I actually did some research and came across it, so it's funny that you mentioned it here.
The problem is that I can't run FTP from my database server but that is where I'm calling the .bat file. So I need to run it on the database server but have it actually execute on the file server. PSEXEC will actually execute from the server you specify. Just as if you were on that server. Pretty cool...
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply