xp_cmdshell オプション

SQL Server 2005 で導入された xp_cmdshell オプションは、xp_cmdshell 拡張ストアド プロシージャをシステムで実行できるかどうかをシステム管理者が制御できるようにするサーバー構成オプションです。新しいインストールでは、xp_cmdshell オプションは既定で無効になっており、ポリシー ベースの管理を使用するか、次のコード例のように sp_configure システム ストアド プロシージャを実行することで有効にできます。

-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO

-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO