August 4, 2015 at 12:25 am
Hey,
I am trying to get the SQL Jobs information and its status through powershell.
can anyone help me how to retrieve these results to html format wise.
can any one give us the code
August 4, 2015 at 3:10 pm
Here is what I use. It runs on a daily basis. It sends 2 emails. One, listing just the jobs we DBA's are interested in, retrieved by category. The second one is a listing of all failed jobs. With a few modifications, it should give you what you want. if you want to use the email part, you will need to modify to your own needs. I get my list of instances from a table, in our admin database, but you can easily put the list in a text file, hardcode it, or what ever you need. I also have a version that gets the information and loads it into a n Excel spreadsheet.
Leonard
August 4, 2015 at 3:24 pm
Straight to html, you can use something like this, combined with the code I previously posted.
# Use this for reporting, if not emailing
$InstanceVersList | Select @{Name='Instance Name';Expression={$_.InstanceName}}, @{Name='Server Name';Expression={$_.ServerName}}, @{Name='Version';Expression={$_.Version}}, @{Name='Patch Level';Expression={$_.PatchLevel}}, @{Name='Edition';Expression={$_.Edition}} `
| ConvertTo-HTML -as Table -head $Header -body $a `
| Set-Content c:\temp\test.htm
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply