0

I am using the PowerShell module BEMCLI and I want to create a report with these columns: list of servers, Jobs associated to the server with the last successful run.

I can get the list of servers with: Get-BEAgentServer

I can get also the list of jobs in success in a period with:

Get-BEJobHistory -JobStatus Succeeded -FromStartTime (Get-Date).AddHours(-24) | ft -auto

Is there an easy way to get what I want?

Mark Wragg
  • 22,105
  • 7
  • 39
  • 68
Med braim
  • 463
  • 1
  • 7
  • 12
  • See PowerShell `Select-Object` cmdlet and [link](https://stackoverflow.com/questions/9813228/add-rows-to-csv-file-in-powershell). – Vivek Kumar Singh Oct 31 '17 at 09:05
  • Can you create your report in `CSV`? If so then, I see that you will need to add columns and not reports to your `CSV`. If that's the case, then [this](https://stackoverflow.com/questions/17022017/add-column-to-csv-windows-powershell) link might be useful. – Vivek Kumar Singh Oct 31 '17 at 09:20
  • yes i can creat the report in CSV , now i can get the list of job of a server by: $Servers=GET-BEAgentServer ForEach ($server in $Servers) { $listJob=Get-BEAgentServer | Where-Object {($_.Name -eq $server)} | Get-BEJob } – Med braim Oct 31 '17 at 12:32
  • i want to put in csv file , in every sheet the name of a sheet= name of server (i can get that on variable $server.name ) , in every put the output of the command in columns , how can i do this in a easy way ? script: – Med braim Nov 13 '17 at 11:30

0 Answers0