If you are on server 2008 you can use a Powershell script. If you are on 2003, you will need to install Powershell if you want to run this. I tested the code below on my two windows 7 machines with windows authentication. Be sure to modify the names in the list of servers and the names of the server and database where you are going to store the results.# Servers to scan
$servers = (
"server1",
"server2",
"server3"
);
# Server and database where data is stored.
$InfrastructureInfoServer = "InfServer";
$InfrastructureDatabase = "InfDatabase";
## Get data from each server and store.
foreach ($s in $servers)
{
# Your query to be run against each server. Assumes windows auth.
$result = Invoke-sqlcmd " `
SELECT `
GETDATE() AS Date, `
@@servername As servername, `
cpu_count AS [Logical CPU Count], `
hyperthread_ratio AS [Hyperthread Ratio], `
cpu_count / hyperthread_ratio AS [Physical CPU Count], `
physical_memory_in_bytes / 1048576 AS [Physical Memory (MB)], `
sqlserver_start_time `
FROM `
sys.dm_os_sys_info WITH (NOLOCK) OPTION(RECOMPILE); " `
-ServerInstance "$s" ;
#Store the results into the Infrastructure server. Assumes windows auth
Invoke-Sqlcmd " `
INSERT INTO Infrastructure_changes values ( `
'$($result[0])', `
'$($result[1])', `
'$($result[2])', `
'$($result[3])', `
'$($result[4])', `
'$($result[5])', `
'$($result[6])' `
) " `
-ServerInstance $InfrastructureInfoServer `
-Database $InfrastructureDatabase
}