December 18, 2006 at 2:59 pm
OK I am at a cross-roads. I am attempting to rebuild an import process that is being streched from one server (app & database on save server) to two seperate severs.
A .bat file needs to run locally on the Application server which is to get triggered from a stored procedure on the database side of things. I am failing to get this process off the ground. I am using PSEXEC to initate the .bat file on a remote server from the database server. Now here is the Odd part.
When I am logged into the database server, I can put in the command line PSEXEC manually into a command window and run it. The command runs successfully. HOWEVER if I run the SAME exact command via xp_cmdshell it errors out.
Here is the command I am using minus the username and password:
psexec \\SR071025 -u USERNAME -p PASSWORD -w D:\xxx\xxxxx D:\xxxx\RunImport.bat -p Smartstream BEMIS
This works when manually run
EXEC master.dbo.xp_cmdshell 'psexec \\SR071025 -u USERNAME -p PASSWORD -w D:\xxx\xxxxx D:\xxxx\RunImport.bat -p Smartstream BEMIS'
This errors out with the following...
The process tried to write to a nonexistent pipe
I am not sure if that is relation to the actual .bat file or something that I have configured wrong...OR somehting wrong with out SQL uses xp_cmdshell.
Any advice or information is appreciated...
Thanks in advance.
Leeland
December 18, 2006 at 4:17 pm
Does SQL server service account has the access to the other system where you trying to run the batch file using psexec?
MohammedU
Microsoft SQL Server MVP
December 19, 2006 at 2:43 am
The 'DOS'environment provided by xp_cmdshell is a subset of the command window environment. In particular, it does not include some of the standard pipes available in the command window, including the console input pipe. Some processes attempt to open these pipes in every situation, even if the command you have given does not require that particular pipe.
I cannot remember all the details and do not have access to BOL on this machine, but check in BOL and maybe Google and you may find the cause of the problem.
Original author: https://github.com/SQL-FineBuild/Common/wiki/ 1-click install and best practice configuration of SQL Server 2019, 2017 2016, 2014, 2012, 2008 R2, 2008 and 2005.
When I give food to the poor they call me a saint. When I ask why they are poor they call me a communist - Archbishop Hélder Câmara
December 19, 2006 at 7:11 am
also psexec is a command line program from sysinternals.com...is that installed in the path on the server?
just one more thing to double check.
Lowell
December 19, 2006 at 10:04 am
Thanks for the replies guys...I will attempt to answer all messages.
The service account DOES have rights on the application server, it is in the local Admin group.
I believe the PSEXEC is installed on both the db server and application server. To Verify I went on the app server, opened a command window and entered PSEXEC and hit enter. I got the PSEXEC help menu...so I believe that is all I needed to do to verify that it was installed.
As for the commend about xp_cmdshell, my boss mentioned to me that in this context it will not work because of "enviornment variables". I really don't know the true concept of what he was getting at...I have a work around in place at the moment but now am getting irritated that I can't figure this out.
I have run the following out of xp_cmdshell to the app server which is a simple test but it shows it works...
PsExec \\SR071025 C:\WINDOWS\system32\cmd.exe
The process tried to write to a nonexistent pipe
I have GOOGLED the hell out of this error message and haven't come up with much in regards to finding out what that actually means. Apparently there are not many people who are trying to run .bat files remotely via xp_cmdshell calls
December 19, 2006 at 3:20 pm
try using IP for \\SR071025
December 19, 2006 at 3:22 pm
I will give that a try tomorrow or later tonight when I have a moment and report back.
Thanks for the info.
leeland
Viewing 7 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply