Hi @Marroquin ,
Agree with Olaf. In addition , error code 2 means File not found.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Realice las siguiente configuración:
EXEC sp_configure 'show advanced options', 1
GO
RECONFIGURE
GO
-- Habilito la ejecucion del xp_cmdshell
EXEC sp_configure 'xp_cmdshell', 1
GO
RECONFIGURE
GO
Cree un usuario nuevo en SQL
----le doy acceso a xp_cmdshell a usuario que se creo anteriormente
GRANT EXECUTE ON [sys].[xp_cmdshell]
TO [UsuarioNuevoSQL]
GO
Asigne un usuario de windows
EXEC sp_xp_cmdshell_proxy_account
N'Dominio\Administrator',
N'Password'
en Directiva de seguridad local, agregue al usuario "administrator" en Asignación de derechos de usuario en iniciar sesion como un trabajo por lotes
y al ejecutar: xp_cmdshell 'dir "C:\TQsoft\CFDI" /s/b>C:\TQsoft\CFDI.txt'; o cualquier otro comando me marca el siguiente error:
Msg 15121, Level 16, State 10, Procedure xp_cmdshell, Line 1 [Batch Start Line 0]
An error occurred during the execution of xp_cmdshell. A call to 'CreateProcessAsUser' failed with error code: '2'.
Hi @Marroquin ,
Agree with Olaf. In addition , error code 2 means File not found.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
In addition to Cathy's answer, this a file that is needed to create the process. That is not the files on the command line, but rather a file associated with the proxy login. Make sure that the proxy login has access to the SQL Server machine.