April 28, 2003 at 12:47 pm
USE master
EXEC xp_cmdshell "print c:\temp.txt " , NO_OUTPUT
I am trying to execute above command and I could not print the text file.
The printer has been set up on the same machine SQL server is running
Can somebody help me out please
April 28, 2003 at 3:27 pm
Remove the no_output parameter, rerun the xp and post again the error message you get.
April 28, 2003 at 3:39 pm
USE master
EXEC xp_cmdshell 'print /D:\\server-3\\hp4100 C:\temp.txt'
OutPut
1 Enable to initialize device \\server-3\\hp4100
2 NULL
November 25, 2010 at 2:47 pm
I am have the same problem, and I am trying to find de solution..
November 25, 2010 at 8:19 pm
longingfriend (4/28/2003)
USE masterEXEC xp_cmdshell 'print /D:\\server-3\\hp4100 C:\temp.txt'
OutPut
1 Enable to initialize device \\server-3\\hp4100
2 NULL
Are you sure the output isn't ...
1 [font="Arial Black"]U[/font]nable to initialize device \\server-3\\hp4100
???
Also, have you tried running that same command from an actual command prompt window? If it doesn't work there, it's not going to work from SQL Server.
--Jeff Moden
Change is inevitable... Change for the better is not.
November 27, 2010 at 12:51 pm
Hi people,
My problem is exact the same.
I have one cmd thats use PRINT command, when I execute this cmd it´s work.
But when a try use xp_cmdshell to execute the error occours.
Unable to initialize device .....
I try to map the shared printer as a LPT port but its doesn't work to.
When a try to use the command COPY File.xt \\Server\Printer_share, the error change.
Access denied...
It´s is related to the account used by SQL Server to run de service?
How to change it´s without security mistakes?
Tank´s..
November 28, 2010 at 10:41 am
This is likely a security/config error for the service account of SQL Server, or the proxy for xp_cmdshell.
First get an account that makes this work. Not your account, but create a domain account and slowly assign rights and configure it to work from the command prompt, when logged in as that account.
Then use that account as the xp_cmdshell proxy.
November 29, 2010 at 8:00 am
login using windows authentiation. and then try it
November 30, 2010 at 5:08 am
Hello,
Using an other domain account on SQL Server service a can print as I want.
But now I am thinking about security consequences, I should give to this account only print rights to make what I need, but what are the others rights that SQL need to work correctly? Should this account be one local administrator?
Thank´s.
November 30, 2010 at 9:06 am
Which account? If you set a proxy for xp_cmdshell, just give it the rights needed.
If you change a service account, use the Configuration Manager. It will assign the correct rights for SQL Server.
November 30, 2010 at 1:31 pm
I try to use this proxy for cmdshel and doesn't work.
Them I change the SqlServer service account, with this change I can print using the xp_cmdshell.
My question now is, wich are the rights that a should give to this user (a domain user)?
Tank´s
November 30, 2010 at 1:53 pm
If you assign the account to SQL Server using the Configuration Manager, it will determine the rights for SQL Server to run.
If you mean that the account you used for the proxy does not work, it needs the rights to accomplish the task. so rights to the printer.
Viewing 12 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply