question

DavidMG-4013 avatar image
0 Votes"
DavidMG-4013 asked Cathyji-msft commented

Does SQL Server Express support the use of a Windows proxy account for xp_cmdshell?

I am attempting to use xp_cmdshell using a proxy user, however even when configuring this user using sp_xp_cmdshell_proxy_account I see this error:
Msg 15137, Level 16, State 1, Procedure sp_xp_cmdshell_proxy_account, Line 1
An error occurred during the execution of sp_xp_cmdshell_proxy_account. Possible reasons: the provided account was invalid or the '##xp_cmdshell_proxy_account##' credential could not be created. Error code: 0(null), Error Status: 0.

When looking at the server properties to see the proxy account specified it is showing it there, but when I run exec xp_cmdshell 'whoami.exe'; it always shows:
nt service\mssql$sqlexpress

This leads me to believe that SQL Server Express does not support a proxy user. I cannot find anything online about this but it seems to be the case. Can someone please confirm this for me or perhaps offer a workaround?

I am using:
Microsoft SQL Server 2016 (SP1-GDR) (KB4505219) - 13.0.4259.0 (X64) Jun 15 2019 19:20:12 Copyright (c) Microsoft Corporation Express Edition (64-bit) on Windows Server 2012 R2 Standard 6.3 <X64> (Build 9600: )

Thank you,

David

sql-server-general
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @DavidMG-4013,

We have not received a response from you. Did the replies could help you? If the response helped, do "Accept Answer". If it is not, please let us know. By doing so, it will benefit all community members who are having this similar issue. Your contribution is highly appreciated.

0 Votes 0 ·
ErlandSommarskog avatar image
0 Votes"
ErlandSommarskog answered

I don't have an Express Edition handy to test on. Then again, when I try on Developer Edition that fails too...

There is no reason why it would fail on Express Edition just because it is Express. But there can be many reasons why things can fail. I know, because I got different error messages when I tried. You get Error code 0 which is strange.

I observe one thing though: you are way behind on the version. You should download and install Service Pack 2, and then apply the most recent Cumulative Update, which I think is CU17. Not that this is likely to resolve this particular issue. But I always point out when people are too far behind on the SP/CU level.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DavidBrowne-msft avatar image
0 Votes"
DavidBrowne-msft answered

Not sure, but when you configure the proxy account from SSMS it creates the credential directly, so you might try that. EG this is the action that configuring a proxy account in SSMS scripts:

 USE [master]
 GO
 CREATE CREDENTIAL [##xp_cmdshell_proxy_account##] WITH IDENTITY = N'theserver\cmdshell', SECRET = N'xxxxxxxx'
 GO


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Cathyji-msft avatar image
0 Votes"
Cathyji-msft answered Cathyji-msft edited

Hi @DavidMG-4013 ,

Does SQL Server Express support the use of a Windows proxy account for xp_cmdshell?

Yes. I test this in my environment. I have SQL 2017 Express. Please run the SSMS as administrator.

89815-screenshot-2021-04-21-152028.jpg

Refer to the blog Creating a SQL Server proxy account to run xp_cmdshell


If the response is helpful, please click "Accept Answer" and upvote it, thank you.



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.