Hello, When I run the following command with the that value of "10000".
Get-VIEvent -maxsamples 10000 -Start (Get-Date).AddDays(–14) |where{$_.Gettype().Name-eq "VmRemovedEvent"} |Sort CreatedTime -Descending|Select CreatedTime, UserName,FullformattedMessage
I get the following error:
Get-VIEvent : 10/1/2018 12:00:15 PM Get-VIEvent Error in deserializing body of reply message for operation
'RetrieveProperties'.
At line:1 char:1
+ Get-VIEvent -maxsamples 10000 -Start (Get-Date).AddDays(–60) |where { ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-VIEvent], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetEvent
But if I reduce that value to less than "1000", the command works.
What am I supposed to do to get a long history of the deleted VMs? and I also need to exclude the service user account used bue Veeam for the SureBackup as the result will be flooded by thousands of irreverent results.
That is a known bug which was fixed in PowerCLI 10.2.0.
Upgrade to 10.2.0
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That is a known bug which was fixed in PowerCLI 10.2.0.
Upgrade to 10.2.0
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
and how to exclude a specific user please?
If you mean from the report, then you can add that condition to the Where-clause.
Something like this
Get-VIEvent -maxsamples ([int]::MaxValue) -Start (Get-Date).AddDays(–14) |
where{$_ -is [VMware.Vim.VmRemovedEvent] -and $_.UserName -ne 'MyUser'} |
Sort -Property CreatedTime -Descending|
Select CreatedTime,UserName,FullformattedMessage
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Worked fine.
Thank you,
