This scripts "walk" in all servers, previously registered in one txt and search for linked servers in every server and test them.Because testconnection method in SMO does not return values just an error, i use the "trap" to insert the linked server with error.
This script use SQLPS minishell of sql server 2008 and one job step powershell. If want to use powershell shell, it is necessary load the snapins for sql server.
First create a txt with all servers and save in a folder (i use C:\dadosps\servers.txt)..something like that
Server1
Server2
Server3\Instance1
And save with name servers.txt
Create repository table in a server repository. I call "SERVER1\MSSQLSERVER_1" and database is "DBA"
This table will have the information about the linked servers with error in all servers.
Finally, we can use this script or save in .ps1
How can i say, i use this script since last year when i did it, its works fine and i call it in a sql server 2008 job step with powershell type.