Skip to content

Latest commit

 

History

History
95 lines (65 loc) · 2.67 KB

sp-xp-cmdshell-proxy-account-transact-sql.md

File metadata and controls

95 lines (65 loc) · 2.67 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs monikerRange
sp_xp_cmdshell_proxy_account (Transact-SQL)
Creates a proxy credential for xp_cmdshell.
markingmyname
maghan
randolphwest
03/07/2025
sql
system-objects
reference
sp_xp_cmdshell_proxy_account
sp_xp_cmdshell_proxy_account_TSQL
sp_xp_cmdshell_proxy_account
xp_cmdshell
TSQL
=azuresqldb-current || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current

sp_xp_cmdshell_proxy_account (Transact-SQL)

[!INCLUDE SQL Server SQL Database]

Creates a proxy credential for xp_cmdshell.

Note

xp_cmdshell is disabled by default. To enable xp_cmdshell, see xp_cmdshell (server configuration option).

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

sp_xp_cmdshell_proxy_account [ NULL | { 'account_name' , 'password' } ]
[ ; ]

Arguments

[!INCLUDE extended-stored-procedures]

NULL

Specifies that the proxy credential should be deleted.

'account_name'

Specifies the Windows account to be the proxy.

'password'

Specifies the password of the Windows account.

Return code values

0 (success) or 1 (failure).

Remarks

The proxy credential is called ##xp_cmdshell_proxy_account##.

When it's executed using the NULL option, sp_xp_cmdshell_proxy_account deletes the proxy credential.

Permissions

Requires CONTROL SERVER permission.

Examples

A. Create the proxy credential

The following example shows how to create a proxy credential for a Windows account called ADVWKS\Max04 with password ds35efg##65.

EXEC sp_xp_cmdshell_proxy_account 'ADVWKS\Max04', 'ds35efg##65';
GO

B. Drop the proxy credential

The following example removes the proxy credential from the credential store.

EXEC sp_xp_cmdshell_proxy_account NULL;
GO

Related content