Hi I have learned a short command to create a CSV from the backup log on my server. I have 5 of them and I wonder if there is a way to show their result in a website format on one pages. The whole aim is to collect various CSV files so I can have a general Server Health Check page that would tell me what I need e.g.:

  • Backup state
  • Computer last logon
  • Server uptime
  • Disk usage etc.

I can fit those on a webpage that is not an issue but...

Whit the Backup:

the command picks a computer's event log and puts the backup in a csv so I can do anything with it in PHP for example or later migrate to SQL or something.

$events = get-winevent -logname Microsoft-Windows-Backup |export-csv -path C:\inetpub\wwwroot\backup.csv

As I have done the first test I realised:

  • it is not as sophisticated as I though I have all the details but: the status is either stop or start so no Done the job command... When you look at the Windows Backup Solution that is easy to read that the task completed or failed. On the event log that is not that simple.

  • the drives are not readable formats if you look at the eventlog there is no C or D drive just codes instead

see below:

Information Stop The system state recovery operation has completed.

Information Info The system state recovery operation that started at '?2013?-?02?-?17T22:43:58.000000000Z' has completed successfully. Log of the files successfully recovered: 'C:\Windows\Logs\WindowsServerBackup\SystemStateRestore-17-02-2013_22-43-58.log'.

Information Stop The backup set of volume '{FFC838C7-793E-11E2-B603-806E6F6E6963}' on the backup storage location has been loaded.

Information Stop The backup set of volume '{FFC838C6-793E-11E2-B603-806E6F6E6963}' on the backup storage location has been loaded.

Information Start The system state recovery operation started at '?2013?-?02?-?17T22:43:58.000000000Z'.

Information Stop The backup operation has completed.

Information Info The backup operation has finished successfully.

Information Start The backup operation has started.

If someone could contribute some better option I would really appreciate. I only just started powershell so I am still learning. Any comment would be great as I am happy to learn.

  • Not to derail this, simply offering up a 3rd party option to get what you are probably ultimately looking for with the data: backupassist.com/BackupAssist/tour_Overview_Notifications.html – TheCleaner Feb 21 '13 at 21:32
  • Hi thanks, but I want to merge some health check info in one webpage and the backup is only one part of it, so 3d party is out of the question – TryHarder Feb 21 '13 at 22:15
  • You might edit your question explaining more about what specific info from the logs you are hoping to gather. – TheCleaner Feb 21 '13 at 22:34
  • Yes you are right I have added some extra bits as well – TryHarder Feb 21 '13 at 22:40

Short version... use get-wbsummary from PS instead and pipe that to a file.

Long Version... I am actually doing something similar. I have a centralized script to do backup and it kicks off wbadmin jobs as part of a script. At about 10am the next morning, I have a backup "checker" that runs on each server. It uses the PS command "get-wbsummary" and dumps that data to a txt file. It then parses that txt file to get the "LastSuccessfulBackupTime" and "LastBackupTime" and compares them. It also does a quick size compare between the disks and the backup VHDs (its never the same and if its close I leave it be). It then takes all the information, and emails me the resulting information. While this is actually in VBS, it very likely could be done more easily in PS completely. I tried going the event log route too, but found there wasn't nearly enough information in there to get me what I needed.

  • interesting though I will have a look at it and probably will merge to two solution - thanks for that – TryHarder Feb 22 '13 at 18:02
  • get-wbsummary is not installed some reason... – TryHarder Apr 13 '13 at 13:57
  • 1
    in order to run it you need to have backup installed on the box that you execute the script from or the powershell modules for managing backup will be missing. – MikeAWood May 2 '13 at 1:58

Rather than use the Export-Csv cmdlet, try using ConvertTo-HTML. It will generate a basic HTML file for you. You can pretty it up with some of the optional parameters, such as -Head, where you could define your CSS classes. If you wish to generate a CSV as well, just put both cmdlets in the pipeline:

<YOUR DATA GENERATOR> | Export-Csv -Path "<PATH TO CSV FILE>" | ConvertTo-Html | Out-File -FilePath "<PATH TO HTML FILE>"
  • Hi Thanks I can cope with the cvs but the log is not that sophisticated as I thought – TryHarder Feb 21 '13 at 21:24
  • Sorry I have edited my question it explains a bit more on that. Thanks anyway – TryHarder Feb 21 '13 at 22:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.