avagham
Enthusiast
Enthusiast

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

Jump to solution

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

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

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

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

0 Kudos
LucD
Leadership
Leadership

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

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

0 Kudos
avagham
Enthusiast
Enthusiast

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

VMware community appreciate your help!!

0 Kudos