2 Replies Latest reply on Nov 22, 2019 7:21 AM by LucD

    Get VM Reconfigure Details from PowerCLI

    Bunty11 Enthusiast

      If a Virtual machine hard disk was increased by some GB.


      can i find from POWERCLI ? when it was increased and who increased it ?



      i tried using Get-VIEvents and Get-Log but i was not getting the details.


      LucFullenwarth  I checked this blog - Events - Part 3 : Auditing VM device changes - LucD notes


      this is pulling information for all VMs. But how to do it for single VM only.

        • 1. Re: Get VM Reconfigure Details from PowerCLI
          Gidrakos Hot Shot

          In LucD's code, you simply need to change :


          while($tasks){ $tasks | where {$_.Name -eq "ReconfigVM_Task"} | % {




          while($tasks){ $tasks | where {$_.Name -eq "ReconfigVM_Task" -and $_.EntityName -eq [vmname]} | % {


          You could pass static text for [vmname] or capture a variable each time you run the script and pass that instead. That will tell the loop to only collect the events which are both Reconfigure tasks and associated with that particular VM.

          • 2. Re: Get VM Reconfigure Details from PowerCLI
            LucD Guru
            Community WarriorsUser ModeratorsvExpert

            You can also change the Task filter.
            This should be a bit faster and place less stress on your vCenter, since only Task objects fitting the filter will be returned.


            Lines 10-15 need to be changed to something like this


            $tFilter = New-Object VMware.Vim.TaskFilterSpec

            $tFilter.Time = New-Object VMware.Vim.TaskFilterSpecByTime

            $tFilter.Time.beginTime = (Get-Date).AddHours(-$hours)

            $tFilter.Time.timeType = "startedTime"

            $tFilter.Entity = New-Object VMware.Vim.TaskFilterSpecByEntity

            $tFilter.Entity.Entity = (Get-VM -Name <your-VM>).ExtensionData.MoRef


            $tCollector = Get-View ($taskMgr.CreateCollectorForTasks($tFilter))

            Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz