Export to HTML/JPG?

Jan 28, 2011 at 11:33 AM

I'm having trouble with the code for exporting anything to a JPG/PNG or whatever.

Is someone able to tell me what i'm doing wrong and tell me how (if possible) i export to HTML (my prefered way of displaying this data)?

I read in another posting that you add this (below) to it, but i don't know where? So i've had a quess...

-On_ContentRendered {
 Export-BootsImage ScreenShot.png $this
$this.close()

 

The Code...

Import-Module powerboots
Import-Module Powerboots\PoshWpf
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin

New-BootsWindow -Content {
Chart -Width 1000 -Height 700 -Theme Theme31 (
 DataSeries $(
 $MDBs = Get-MailboxDatabase | ? {$_.Server -like '(servername)*'} | Select Identity
 foreach ($MDB in $MDBs) {
 $count = (Get-Mailbox -Database $MDB.Identity | Measure-Object).Count
 DataPoint -YValue ($count) -AxisXLabel $MDB.Identity 
 }
  )  -RenderAs bar -On_ContentRendered {Export-BootsImage "C:\TempScreenShot.png"}
)} -Title "Number of users per Mailbox Database"

 

Any help would be greatly appreciated. If anyone can explain to me how to export it to a html file that would be fantastic?

Thanks...Great software by the way!

Jan 28, 2011 at 3:19 PM

After some modifications i now get getting a message saying (error below).

Unknown Dependency Property Key: On_ContentRendered on DataPoint

 

Modified end of code

 $count = (Get-Mailbox -Database $MDB.Identity | Measure-Object).Count
 DataPoint -YValue ($count) -AxisXLabel $MDB.Identity -On_ContentRendered {
    Export-BootsImage Test.jpg $this
    $this.close()
}
}
  )  -RenderAs Bar
)}

Jan 28, 2011 at 4:24 PM

Ok. Finally got the export to JPG working, however if someone can point me in the direction of the HTML export that would be great?

Saying the above, my new problem is the graph is empty. I read you need to turn off the animations> AnimationEnabled:False? Where do i put that?

 

New Code..

Import-Module powerboots
Import-Module Powerboots\PoshWpf
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin

New-BootsWindow -Content {
Chart -Width 1000 -Height 700 -Theme Theme2 (
 DataSeries $(
 $MDBs = Get-MailboxDatabase | ? {$_.Server -like '(servername)*'} | Select Identity
 foreach ($MDB in $MDBs) {
 $count = (Get-Mailbox -Database $MDB.Identity | Measure-Object).Count
 DataPoint -YValue ($count) -AxisXLabel $MDB.Identity
 }
  )  -RenderAs Bar
)} -On_ContentRendered {
            Export-BootsImage  C:\Temp\Wayhey.jpg $this
         $this.close()
}

Coordinator
Jan 30, 2011 at 5:18 AM

Which Chart are you using? Visifire? I believe you need -AnimationsEnabled:False as a parameter to Chart in order to get it to draw the chart immediately.

Also, there should be a New-BootsImage command, which you can use instead of New-BootsWindow (so you can leave off manually writing the On_ContentRendered handler)

Feb 1, 2011 at 9:30 AM

Excellent. Thanks Jaykul. I've now got it saving to JPG with the -AnimationEnabled:$False switch. the New-BootsImage command works as well so thanks for that.

There is something else which you or someone else may be able to help me with. I'm trying to produce a graph from a CSV file with 2 columns (Name & Count). I'm trying to end up with a bar chart which will show the appropriate data. Are you able to point me in the right direction for the commands?