This powershell script is sample code to run query against multiple SQL Servers and export the combined output to Excel. This Excel file is later sent as email attachment using hotmail.
Related email thread: http://social.msdn.microsoft.com/Forums/en-US/sqldatabaseengine/thread/987d48c0-a82d-4424-8699-cdd0b2bc9c51
# This posting is provided “AS IS” with no warranties, and confers no rights.
Script can be also downloaded from emailResultsMultiServerQuery.ps1


Very Nice Script ! Helped me a lot .. Good Work..
Comment by sqlfrndz — June 14, 2012 @ 2:10 pm |
Hi Sethu. thanx for the script. how can i combine the following script to yours? i need the event list to be exported to an excel sheet and send out via email. i got the first part working. how can i combine both ? here’s the command i use -> Get-EventLog -LogName application | where { (($_.entrytype -eq “Error”) -or ($_.entrytype -eq “Warning”)) -and ($_.timewritten -ge (get-date).addDays(-1))} | export-csv “C:\scripts\appevents.csv
Comment by jaya1984 — October 9, 2012 @ 9:16 pm |