xp_cmdshell オプションは SQL Server サーバー構成オプションであり、システム管理者は、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