msdat
msdat copied to clipboard
xp_cmdshell Restore Service to Identified State
My team uses msdat non-interactively against a ton of machines using GNU's parallel command. We like to check and see if xp_cmdshell can be executed. Currently xp_cmdshell allows the user to enable or disable the xp. However, I'd like to be able to restore the xp_cmdshell to how we found it so that I am not leaving xp_cmdshell enabled if was already disabled on client environments.
So the breakdown would be:
- If xp_cmdshell is disabled and can be enabled:
- Enable
- Execute
- Disable
- If xp_cmdshell is enabled:
- Execute