VMware Cloud Community
avagham
Enthusiast
Enthusiast
Jump to solution

Error in deserializing body of reply message for operation 'RetrieveProperties' and Error in deserializing body of reply message for operation 'ReadPreviousEvents'

Hello everyone - i'm getting below errors while running script to get newly added VMs across multiple vCenters. Am i missing anything? please advise.

Errors:

Get-VIEvent : 8/13/2020 10:19:17 AM    Get-VIEvent        Error in deserializing body of reply message for operation 'RetrieveProperties'.   

At line:5 char:11

+ $events = Get-VIEvent -maxsamples 100000 -Start (Get-Date).AddDays(–1 ...

+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Get-VIEvent], VimException

    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetEvent

Get-VIEvent : 8/13/2020 10:19:24 AM    Get-VIEvent        Error in deserializing body of reply message for operation 'ReadPreviousEvents'.   

At line:5 char:11

+ $events = Get-VIEvent -maxsamples 100000 -Start (Get-Date).AddDays(–1 ...

+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Get-VIEvent], VimException

    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetEvent

Script:

Import-Module VMware.VimAutomation.Core

Connect-VIServer vCenter

$eventCollection = @()

$events = Get-VIEvent -maxsamples 100000 -Start (Get-Date).AddDays(–10) | where {$_.Gettype().Name-eq "VmCreatedEvent" -or $_.Gettype().Name-eq "VmBeingClonedEvent" -or $_.Gettype().Name-eq "VmBeingDeployedEvent" }

foreach ($event in $events)

{

$csvline = "" | Select EventTime, UserName, Datacenter, Cluster, Host, VM, Dvs, Description, vcenter

$csvline.EventTime = $event.CreatedTime

$csvline.UserName = $event.UserName

$csvline.Datacenter = $event.Datacenter.Name

$csvline.Cluster = $event.ComputeResource.Name

$csvline.Host = $event.Host.Name

$csvline.VM = $event.VM.Name

$csvline.Dvs = $event.Dvs.Name

$csvline.Description = $event.FullFormattedMessage

$csvline.vcenter = $event.VC.Name

$eventCollection += $csvline

}

$eventCollection | Export-csv -NoTypeInformation E:\output_file.csv

Thanks in advance.

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You seem to be still using an MSI based install.

Time to upgrade.

Find the instructions in Welcome PowerCLI to the PowerShell Gallery – Install Process Updates


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

5 Replies
LucD
Leadership
Leadership
Jump to solution

This was a known issue.

Which PowerCLI and vSphere version are you using?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

avagham
Enthusiast
Enthusiast
Jump to solution

Please check information below:

PowerCLI:

PowerCLI Version

----------------

   VMware PowerCLI 6.5 Release 1 build 4624819

---------------

Component Versions

---------------

   VMware Cis Core PowerCLI Component 6.5 build 4624453

   VMware VimAutomation Core PowerCLI Component 6.5 build 4624450

vSphere:

Version 6.7.0 Build15976728

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

You seem to be still using an MSI based install.

Time to upgrade.

Find the instructions in Welcome PowerCLI to the PowerShell Gallery – Install Process Updates


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

avagham
Enthusiast
Enthusiast
Jump to solution

Thanks for your recommendation. Let me get powerCLI updated and let you know if the issue still persist. Thank you!!

Reply
0 Kudos
avagham
Enthusiast
Enthusiast
Jump to solution

Thanks LucD as always, i was able to upgrade powerCLI to latest version and error is gone Smiley Happy

VMware community appreciate your help!!

Reply
0 Kudos