Pages: [1]
Print
Author Topic: Script to list the number of active snapshots?  (Read 1013 times)
bmmikee
Newbie
*
Posts: 11


View Profile Email
« on: December 30, 2009, 09:17:22 AM »

I have the health script working great, it displays all the snapshots.  I want to create a summary section at the top with something along the lines of:

There are 6 active snapshots

Great site, i've incorporated a lot of your scripts.


I'm currently using this to list the snaps:

#############
# Snapshots #
#############
$snap | select vm, name,created,description | ConvertTo-Html -title "Snaphots active" -body "<H2>Snapshots active.</H2>" | Out-File -Append $filelocation
« Last Edit: December 30, 2009, 09:19:13 AM by bmmikee » Logged
esarakaitis
Administrator
Full Member
*****
Posts: 247


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« Reply #1 on: December 30, 2009, 09:54:26 PM »

Thanks! I'll have to do some playing with the HTML stuff at the office... but im sure you could use measure-object | slect count as a variable and insert it into the page like:

Code:
There are $SnapCount active snapshots

but at the same time, how do you know that those snapshots are active? they could be old news right?
Logged
bmmikee
Newbie
*
Posts: 11


View Profile Email
« Reply #2 on: January 04, 2010, 10:50:57 AM »

Sounds good, thanks!
Logged
bmmikee
Newbie
*
Posts: 11


View Profile Email
« Reply #3 on: January 12, 2010, 09:20:06 PM »

Thanks! I'll have to do some playing with the HTML stuff at the office... but im sure you could use measure-object | slect count as a variable and insert it into the page like:

Code:
There are $SnapCount active snapshots

but at the same time, how do you know that those snapshots are active? they could be old news right?

Actually I would be looking for old and new snapshots so it wouldn't really matter.  Did you by chance get some time to play with that?
Logged
esarakaitis
Administrator
Full Member
*****
Posts: 247


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« Reply #4 on: January 13, 2010, 10:32:23 PM »

i have not been able to get the HTML stuff working
Logged
ewannema
Administrator
Newbie
*****
Posts: 31


View Profile WWW
« Reply #5 on: January 14, 2010, 11:57:18 AM »

Convert-ToHtml is fairly basic in what it does.  The output is going to be a table of data with some minor customization.  It is not really going to create a custom layout for you.

If you want custom html you will have to create it yourself.  You can still use ConvertTo-Html to generate the table section of HTML if you want using the -fragment parameter.

Code:
"<head></head><body><p>There are <b>$snapCount</b> active snapshots.</p></body>"
Logged
Pages: [1]
Print
Jump to: