Is there a way to find deleted VM's from vcenter database?
Yes, provided you keep the events for that long.
Get-VIEvent -Start $start -MaxSamples ([int]::MaxValue) |
where{$_ -is [VMware.Vim.VmRemovedEvent]}
---------------------------------------------------------------------------------------------------------
Was it helpful? Let us know by completing this short survey here.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes, provided you keep the events for that long.
Get-VIEvent -Start $start -MaxSamples ([int]::MaxValue) |
where{$_ -is [VMware.Vim.VmRemovedEvent]}
---------------------------------------------------------------------------------------------------------
Was it helpful? Let us know by completing this short survey here.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I tried to run above script it given below error. Get-VIEvent : 7/11/2019 12:09:32 PM Get-VIEvent Error in deserializing body of reply message for operation 'ReadPreviousEvents'. At line:4 char:1 + Get-VIEvent -Start $start -MaxSamples ([int]::MaxValue) | where{$_ -i ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Get-VIEvent], VimException + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetEvent
That's a known issue in older PowerCLI versions.
Update your PowerCLI version.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I am using VMware PowerCLI 10.1.0 version. I believe it is updated version
I'm afraid not, the 10.* versions is where this problem popped up.
In the latest release 11.3, the issue is solved.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you @LucD
I just upgraded to 11.3 and recieve this error:
$ : The term '$' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ $ start = ( Get-Date ).AddDays ( -30 ) | Get-VIEvent -Start $start -M ...
+ ~
+ CategoryInfo : ObjectNotFound: ($:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Thanks, I'm new to this
Gary
You seem to have a blank between the $ and the word 'start'
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference