# Strategy - SQL Server does the job. PowerShell is used as
the carrier for multiple servers.
# Create a job on one instance, script it, and then save the
T-SQL script in a file (txt or whatever as long as the content can be read)
# In Powershell, execute the following script:
# If you want the intellisense, you may need to import the
module
#import-module sqlps -disableNameChecking
# Option 1- for a few servers
# $a="Localhost","LocalHost\I2"
# Option 2 - retrieve the server name from a txt file
$a=get-content "C:\users\xu-acer\documents\Servers.txt"
# Option 3 - retrieve the server name from a SQL Server table
# invoke-sqlcmd -ServerInstance "localhost"
-database "MyDB" -query "Select ServerName from
dbo.Servers"
$a | % {
$Server=$_;
$Server
invoke-sqlcmd
-ServerInstance $Server
-database "msdb"
-InputFile "C:\users\xu-Acer\documents\PSErrorLog.txt"
}