2 Replies Latest reply on May 15, 2019 11:55 PM by Sivaramsharmar

    VM Cloned from Past couple of days

    Sivaramsharmar Enthusiast

      Hi All,

       

      I am trying to fetch the VM Details which was created from past couple of days.

      I am getting the output, but when trying to filter only with VM name I am not getting exact output.

       

      Get-VIEvent -MaxSamples 10000 |where {$_.Gettype().Name-eq "VmCreatedEvent"} |Sort CreatedTime -Descending |Select CreatedTime, UserName,@{N='VM Name';E={$_.FullformattedMessage.split('to')[2].split(' ')[2]}},@{N='Provisioned Type';E={"Created"}}

      Get-VIEvent -MaxSamples 10000 |where {$_.Gettype().Name-eq "VmBeingClonedEvent"} |Sort CreatedTime -Descending |Select CreatedTime, UserName,@{N='VM Name';E={$_.FullformattedMessage.split('to')[10]}},@{N='Provisioned Type';E={"Cloned"}}

       

      Expected Output:

       

      CreatedTime           UserName                VM Name        Provisioned Type
      -----------           --------                -------        ----------------
      5/15/2019 12:00:23 PM Domain\Userid VM1   Created

      5/15/2019 14:00:23 PM Domain\Userid VM2   Cloned

       

      But Output is coming as below:

      CreatedTime           UserName                VM Name        Provisioned Type
      -----------           --------                -------        ----------------
      5/15/2019 12:00:23 PM Domain\Userid xyz VM1   Created

      5/15/2019 14:00:23 PM Domain\Userid lmwsdf VM2   Cloned