Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 xp_cmdshell error in MessageQueue; but not in SSMS

Author  Topic 

shamilsal
Starting Member

2 Posts

Posted - 2015-04-02 : 15:40:54
Hi All,

I have a SP, which calls xp_cmdshell in it. This SP is being used in a MessageQueue.

The SQL server and Agent services are configured using a Domain service account, and this service account has a login under the sysadmin server role as well.

When the MessageQueue is invoked, the SP returns the following exception :
The xp_cmdshell proxy account information cannot be retrieved or is invalid. Verify that the '##xp_cmdshell_proxy_account##' credential exists and contains valid information.

But when I execute the SP in SSSMS, under the service account login (which is a sysadmin), it successfully executes.

I even created the ##xp_cmdshell_proxy_account## credential, but the Message Queue never stops giving this error.

This is how the queue looks like :
CREATE QUEUE [dbo].[TestxmCmdshellQueue]
WITH STATUS = ON ,
RETENTION = OFF ,
ACTIVATION ( STATUS = ON ,
PROCEDURE_NAME = [dbo].[SpWithxp_cmdshell_Init] ,
MAX_QUEUE_READERS = 5 ,
EXECUTE AS N'dbo' ),
POISON_MESSAGE_HANDLING (STATUS = OFF)

The Service account is configured as a Local Administrator in the Local Server as well.

I am running SQL Server 2008 R2 Sp2 on a Windows Server 2008 R2 Enterprise Machine.

Please let me know what I am missing here.

shamilsal
Starting Member

2 Posts

Posted - 2015-04-06 : 09:23:51
Hi All,

I Made TRUSTWORTHY = ON in the database and the SP executed without any problem by the Message Queue.

Thanks !
Go to Top of Page
   

- Advertisement -