- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
looks like it but when I run it nothing is coming up...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
And you are sure you have datastores that would get through the Where-clause?
Perhaps try changing the numbers to other thresholds.
I'll do some more tests as well.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ah yes that was it. I adjusted the thresholds and got some results. If I also want to add the columns for FreeSpace%, ProvisionedSpace% and Uncommitted%
are my calculations correct?
@{N='Freespace%';E={[math]::Round($_.FreespaceGB/$_.CapacityGB*100,1)}},
@{N='ProvisionedSpace%';E={[math]::Round((($_.ExtensionData.Summary.Capacity - $_.Extensiondata.Summary.FreeSpace + $_.ExtensionData.Summary.Uncommitted)/1GB)/$_.CapacityGB*100,1)}},
@{N='UnCommittedGB%';E={[math]::Round(($_.ExtensionData.Summary.Uncommitted/1GB)/$_.CapacityGB*100,1)}},
Thanks so much
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, looks good.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This works perfectly thanks so much. One last question I have though is that I am using this alert for few things. One is to send an email, however I only want the email to be sent when there is actual output. How do I add that into logic into the script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you want to send an email for each datastore that hits the watermarks, or one email for all the datastores, and then only when there are datastores?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just need to have one email for anything that meets the criteria please!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You mean something like this?
Only when there is something in $report will there be an email
$report = Get-Datastore |
where {((($_.ExtensionData.Summary.Capacity - $_.Extensiondata.Summary.FreeSpace + $_.ExtensionData.Summary.Uncommitted)/1GB)/$_.CapacityGB) -ge 1.75 -and
($_.FreeSpaceGB/$_.CapacityGB) -le 0.05} |
Select @{N='Datacenter';E={$_.Datacenter.Name}},
@{N='DSC';E={Get-DatastoreCluster -Datastore $_ | Select -ExpandProperty Name}},
Name,CapacityGB,
@{N='FreespaceGB';E={[math]::Round($_.FreespaceGB,2)}},
@{N='ProvisionedSpaceGB';E={
[math]::Round(($_.ExtensionData.Summary.Capacity - $_.Extensiondata.Summary.FreeSpace + $_.ExtensionData.Summary.Uncommitted)/1GB,2)}},
@{N='UnCommittedGB';E={[math]::Round($_.ExtensionData.Summary.Uncommitted/1GB,2)}},
@{N='VM';E={$_.ExtensionData.VM.Count}}
$report | Export-Csv report.csv -NoTypeInformation -UseCulture
if($report){
Send-MailMessage -To me@domain.com -from you@domain.com -Subject 'Report' -SmtpServer mail.domain.com -Attachments report.csv -
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
exactly. perfect.
thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi LucD ,
I am new to VMware and PowerCLi topics, I would like to generate a .csv file in following format :
ClusterName | ClusterCapacity | ProvisionedSpace | ClusterOverProvision% | Host OS Type
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I suggest to open a new thread for your question.
And explain if the values you want to see are only for storage?
Do you mean the ESXi version with 'Host OS Type'?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi LucD, I have created new question, you can check here (PowerCLi script to get ClusterName | ClusterCapacity | ProvisionedSpace | ClusterOverProvision% | Ho... )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi LucD,
For me also its working fine but i need VM names also along with this out put, is it possible ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi LucD,
Its working for me as well but i need VM names along with VM count against datastore, can you help me with this pls ?