Can we script out all linked Servers at single go? is there any script available?
Hi All,

We are migrating SQL 2008 instances to SQL 2014. Looking for help regarding Linked Servers.
Is there a way to script out all linked servers along with passwords?

Appreciate if anyone can help.

Thank you.
August 30th, 2015 5:15pm

http://www.sqldbadiaries.com/2010/10/22/generate-scripts-for-linked-servers/
Free Windows Admin Tool Kit Click here and download it now
August 30th, 2015 8:42pm

Hi,

Basically looking for script which can script out all Linked Servers.

Thanks

August 31st, 2015 2:34am

Hi Samantha,

According to your description, you need to list all the linked servers on one server by using a script, right?

There are several methods for viewing the details of linked servers in SQL Server. One can use the SSMS UI to view properties or view facets, or one can even read through the scripted linked server. The easiest method to view the details for one or all linked servers is the query the SQL Server system tables. Here is the sample script for you reference.

SELECT *
FROM sys.Servers a
LEFT OUTER JOIN sys.linked_logins b ON b.server_id = a.server_id
LEFT OUTER JOIN sys.server_principals c ON c.principal_id = b.local_principal_id

Reference
http://jwcooney.com/2011/10/26/sql-server-how-to-list-the-full-properties-of-all-linked-servers/

Regards,

Free Windows Admin Tool Kit Click here and download it now
August 31st, 2015 2:50am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics