Skip to main content

Easiest Way (SSMS)

You can't script it through openquery if you don't have permissions on the master database (nor should you).

From the object explorer

+Linked Objects

++Linked Servers

+++[Linked Server Name]

Left click the linked server name Script Linked Server As > Create To > New Query Editor Window

Look for @datasrc='linked server source here'

Voila!