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

Re: Powershell/PowerCLI Dynamic Email Message Body with Datastores

$
0
0

Fabien, not sure if you can help through this same thread. You helped me with the script and output sorts by PercFree. I did added another column to reflect FreeSpace on the following function:

Function Report-Datastore {

    $output = @()

    Get-Datastore | ForEach-Object {$props = [ordered]@{'Name'=$_.Name;'FreeSpace'=[math]::Round(($_.FreeSpaceGB),2);'UsedSpace'=[math]::Round(($_.CapacityGB - $_.FreeSpaceGB),2);'PercFree'=[math]::Round((100 * ($_.FreeSpaceGB/$_.CapacityGB)),0)}

        $output += New-Object -TypeName PSCUstomObject -Property $props

    }

    $output

}

But i added the sort-object FreeSpaceGB in HTML code section and does not sort.

$html_DS = Report-Datastore | Sort-Object FreeSpaceGB | ConvertTo-HTML -Fragment | Out-String | Set-AlternatingCSSClasses -CSSEvenClass 'even' -CssOddClass 'odd'

#$html_DS = Report-Datastore | Sort-Object PercFree | ConvertTo-HTML -Fragment | Out-String | Set-AlternatingCSSClasses -CSSEvenClass 'even' -CssOddClass 'odd'

The following is the output of the body email. Thanks for your help

Capture.PNG 


Viewing all articles
Browse latest Browse all 201745

Trending Articles



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