Sorry, the machine was my mistake. But when I put 9999 or -7 both reports are the same
On the other hand, the machines that report to me are only 1 year old, so I will not get 100% of the machines turned off, right?
It all depends on how long you keep events in your environment.
I can't explain why you would see the same result with -7 or 9999.
Or do you mean neither of these return anything?Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
it depends on the retention time of your vcenter settings. if the value of event retention days for example is 365 days then older events are deleted from the seat-database and you can not query them.
i can confirm that the code is working and giving valid results with days -7000 and greater. no results wih -99999
Can you check what the retention date is in your environment?Get-AdvancedSetting -Entity $global:defaultVIServer -Name "event.maxAge"
Get-AdvancedSetting -Entity $global:defaultVIServer -Name "event.maxAgeEnabled"
Btw, I assume you are connected to a vCenter, and not an ESXi node?Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
Both report the same. 270 VM but... in 1 month its too i think
Ok, so you keep events for 30 days.
There is no point, in that case, going back further than 30 days.
Just to clarify, is that 99999 or -99999?
The minus sign makes a difference.
And what makes you think that 270 VMs is too much?
Don't you have 270 VMs in your environment?
Or do you see the same VM multiple times in the report?Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
Yes, I have more than 270 vm, but it seems strange that I turned off 270 in just one month.
-The value is 99999 or -7, I've left it at 99999
-The report is fine, none is repeated
But it is working because I just removed a shutdown and it no longer appears in the following report.