You can export linked servers as SQL using the following steps:
- Open SQL Server Management Studio (SSMS) and connect to the instance of SQL Server you want to export linked servers from.
- Expand the server node, then expand the Server Objects node.
- [Trick!] Press F7 to open Jobs in Object Explorer when “Server Objects” node is selected. Now you can multiple Linked Servers by holding the Ctrl key and clicking on each item.
- Right-click the Linked Servers node and select Script Linked Server As → CREATE To → New Query Editor Window. This will generate a SQL script that creates the linked servers as they currently exist on the server.
- Save the SQL script to a file if you wish.
That's it! You now have a SQL script that can be used to recreate the linked servers on another server or on the same server after a re-installation.