My team is migrating a SQL 2012 server with an extensive list of linked servers to SQL 2016. My task is to script the creation of linked servers on the new server.

It looks like I have all the information I need to create the script in sys.servers but am having trouble finding where local logins are mapped to the linked servers.

1 Answer 1


You'll find the linked servers login mappings in sys.linked_logins view.

This, in turn accesses the master.sys.syslnklgns table (in case this gives something useful), but you can only access the real systems tables when you connect using the Dedicated Admin Connection (/A with sqlcmd.exe).

  • Thank you! Are remote passwords available for scripting?
    – Metaphor
    Oct 2, 2020 at 16:43
  • Apparently, according to dbatools.io. Check it out, the cmdlet to copy linked servers. Oct 2, 2020 at 18:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.