After updating Windows and SQL Server, xp_cmdshell
is running slowly. We are running Windows Server 2016 with SQL Server 2016 SP1. We've fully updated SQL Server to SP2 CU8 with no change in behavior.
The performance of our Windows Server seems great. Also, we can run similar commands in batch with great speed. The performance of our SQL Server seems great as well.
I'm guessing that the issue is with each command needing a Windows environment, and maybe something changed recently with Windows? However, we don't see any issues on our virtual machines running the same version of SQL Server 2016.
We understand the security risks of having xp_cmdshell
enabled and accept those risks.
Here is some code we use to test the speed on xp_cmdshell
.
EXEC master..xp_cmdshell 'exit 0' --Simple, Open cmd, and exit
GO 25 --Run the command 25 times
I expect this code to run in under a second, however it's taking 15-20 seconds to run.