December 11, 2008 at 10:02 am
Hi,
I'm trying to figure out how to execute a batch file on different server and have it run there and not from where I'm calling it. Could anyone tell me how I can accomplish this.
Thanks in advance!
😀
December 11, 2008 at 10:15 am
it's kind of difficult, becuase the remote server would need to be able to login to the network in order to get to a UNC path to the batch file...
declare @command varchar(1000)
set @command = '"\\myOtherServer\PATH\TO\FILE\mybatch.bat'
print @command
exec master..xp_cmdshell @command
you might need to change the account that is running the service,a nd of course use the surface area configuration to allow xp_commandshell on that remote server as well.
once you know that the other server can get to the file,
it depends on what the file is doing to determine whether even that might fail separately due to assumed paths and stuff like that.
Lowell
December 11, 2008 at 10:33 am
rereading, you might want to look at psexec.exe from sysinternals (now from MS):
http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx;
it is an administrative tool that can be used to run executables on other machines, regardless of whether,s ay, SQL Server exists or not.
that may be what you are looking for.
Lowell
December 11, 2008 at 10:36 am
Great! I'll take a look. Thanks for all your help Lowell!
December 11, 2008 at 3:45 pm
If you want to execute the entire SSIS package on a different server, then just use the sql server agent which supports this I believe. If you only want to execute a portion of the package on a different server, then yeah the last suggestion is an option. I also believe WMI supports execution things remotely but I haven't done that from a package before.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply