Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 219257

Change datastore output to alphabetical

$
0
0

Hey all,

 

I have a report that outputs all our datastores and the % Free but the output is just all the datastores at random.  I would LOVE if it would output in alpha order.  Any ideas?

 

 

function UsedSpace

{

  param($ds)

  [math]::Round(($ds.CapacityMB - $ds.FreeSpaceMB)/1024,4)

}

 

 

function FreeSpace

{

  param($ds)

  [math]::Round($ds.FreeSpaceMB/1024,4)

}

 

 

function PercUsed

{

  param($ds)

  [math]::Round((100 * ($ds.CapacityMB - $ds.FreeSpaceMB) / $ds.CapacityMB),2)

}

 

 

$Datastores = Get-Datastore

$myCol = @()

ForEach ($Datastore in $Datastores)

{

  $myObj = "" | Select-Object Datastore, PercUsed

  $myObj.Datastore = $Datastore.Name

  $myObj.PercUsed = PercUsed $Datastore

  $myCol += $myObj

}

$myCol | Sort-Object PercFree | ConvertTo-Html –title "Datastore space " –body "<H2>Datastore space available.</H2>" -head "<link rel='stylesheet' href='style.css' type='text/css' />" | Out-File -Append $filelocation


Viewing all articles
Browse latest Browse all 219257

Trending Articles



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