|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Friday, May 10, 2013 5:51 PM
Points: 54,
Visits: 121
|
|
Hi All,
Please have a look at the below link and help me to get the details (as 4 Columns) into a SQL Server table instead of Mail as I can make a SSR report from the data. SERVER = JOB = LASTRUN = LASTRUNDATE =
http://www.sqlservercentral.com/blogs/sqlsandwiches/2012/01/29/find-failed-sql-jobs-with-powershell/
Regards Srikanth Reddy Kundur
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Tuesday, April 30, 2013 12:43 PM
Points: 46,
Visits: 722
|
|
| Have you tried to change the part where it says $msg.body = $msg.body + "`n `n FAILED JOB INFO:... [snip] to something like this
$sql = "insert YourTableName (server, job, last_run_status, last_run_date) values ('$sqlserver', '$jobname', '$jobLastRunOutcome', '$jobLastRun');"
then run that into your SQL Server? Adjusted, of course, for your table structure. If you have something that's failing send the code and error message and maybe someone here could help a little more.
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Friday, May 10, 2013 5:51 PM
Points: 54,
Visits: 121
|
|
Changed the code as suggested, the job executes successful but no records are getting inserted, Can anyone help on the script please.
Regards S.R.Kundur
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 11:25 PM
Points: 946,
Visits: 1,739
|
|
|
|
|