So I want to enable xp_cmdshell through a linked server. This is my attempt:
set @execute = 'exec '+'['+@server_ip+']'+'.master..sp_configure ''xp_cmdshell'', 1;'
set @reconfigure = 'exec '+'['+@server_ip+']'+ 'reconfigure'
exec sp_executesql @execute
exec sp_executesql @reconfigure
I have to run the reconfigure command, as I receive this message:
'Configuration option 'xp_cmdshell' changed from 0 to 1. Run the RECONFIGURE statement to install.'
The reconfigure part does not work. I don't know how to activate the reconfigure command through a linked server. Thanks!