Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 176483

Decimal round of size

$
0
0

Here is a portion of my script. Can someone please assist with the rounding of the sizemb on the last line

When I run this I am getting the following

 

34.457454758739874837483

 

I would like it to round of to the nearest MB or 1 decimal place (either 34MB or 34.5MB)

 

Big Thanks.

 

$VMsWithSnaps = @(Get-VM | Get-Snapshot | Select vm,name,sizemb)

 

 

if($VMsWithSnaps -ne $null){

  $body = @("

  <center><table border=1 width=60% cellspacing=0 cellpadding=8 bgcolor=Black cols=3>

  <tr bgcolor=White><td>Virtual Machine</td><td>Snapshot</td><td>Size in MB</td></tr>")

 

  $i = 0

 

  do {

  if($i % 2){$body += "<tr bgcolor=#D2CFCF><td>$($VMsWithSnaps[$i].VM)</td><td>$($VMsWithSnaps[$i].Name)</td><td>$($VMsWithSnaps[$i].Sizemb)</td></tr>";$i++}


Viewing all articles
Browse latest Browse all 176483

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>