This blog article shows how to script multi server queries through PowerShell that can be scheduled as a SQL Agent job. Unfortunately, outputing to the PowerShell window is not useful for something that is automated. I'd like to write the output to a table on my CMS. Enquired as to how that can be done in another thread.
Hmmm... Interesting idea. I need to check this out.
>>Unfortunately, outputing to the PowerShell window is not useful for something that is automated.
sqlcmd.exe and the -o switch can help you get around this limitation of invoke-sqlcmd.
Alternatively, this may help too:
invoke-sqlcmd -ServerInstance $DatabaseConnection_STR -Database dba -Query "select select serverproperty('InstanceName')" -Verbose