ITenGriTR
Contributor
Contributor

Get-Vm | Get-Stat Error PowerCLI

Jump to solution

I am trying this command but i am getting error

https://developer.vmware.com/docs/powercli/latest/vmware.vimautomation.core/commands/get-stat/#Defau...

Get-VM -Name "MyVM" | Get-Stat -Stat "mem.usage.average" -Start $MyStartDateTime -Finish $MyFinishDateTime -MaxSamples 10

 

Get-Stat : 15.06.2021 17:11:32  Get-Stat
Required property instance is missing from data object of type PerfMetricId
while parsing serialized DataObject of type vim.PerformanceManager.MetricId
at line 1, column 303
while parsing property "metricId" of static type ArrayOfPerfMetricId
while parsing serialized DataObject of type vim.PerformanceManager.QuerySpec
at line 1, column 248
while parsing call information for method QueryPerf
at line 1, column 171
while parsing SOAP body
at line 1, column 64
while parsing SOAP envelope
at line 1, column 0
while parsing HTTP request for method queryStats
on object of type vim.PerformanceManager
at line 1, column 0
At line:1 char:62
+ ... vodofone" | Get-Stat -Stat "mem.usage.average" -Start 14/6/2021 -Fini ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-Stat], InvalidRequest
    + FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_GetStats_ErrorRetreivingPerfMetrics,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetViStats

 

Modules:

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     12.2.0.... VMware.CloudServices                {Connect-Vcs, Disconnect-Vcs, Get-VcsOrganizationRole, Get-VcsService...}
Script     7.0.2.1... VMware.DeployAutomation             {Add-CustomCertificate, Add-DeployRule, Add-ProxyServer, Add-ScriptBundle...}
Script     7.0.2.1... VMware.ImageBuilder                 {Add-EsxSoftwareDepot, Add-EsxSoftwarePackage, Compare-EsxImageProfile, Export-EsxImageProfile...}
Manifest   12.3.0.... VMware.PowerCLI
Script     7.0.2.1... VMware.Vim
Script     12.3.0.... VMware.VimAutomation.Cis.Core       {Connect-CisServer, Disconnect-CisServer, Get-CisService}
Script     12.0.0.... VMware.VimAutomation.Cloud          {Add-CIDatastore, Connect-CIServer, Disconnect-CIServer, Get-Catalog...}
Script     12.3.0.... VMware.VimAutomation.Common         {Get-PowerCLIContext, Get-Task, New-OAuthSecurityContext, Stop-Task...}
Script     12.3.0.... VMware.VimAutomation.Core           {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAdapter, Add-VMHost, Add-VMHostNtpServer...}
Script     12.3.0.... VMware.VimAutomation.Hcx            {Connect-HCXServer, Disconnect-HCXServer, Get-HCXAppliance, Get-HCXComputeProfile...}
Script     12.3.0.... VMware.VimAutomation.HorizonView    {Connect-HVServer, Disconnect-HVServer}
Script     12.0.0.... VMware.VimAutomation.License        Get-LicenseDataManager
Script     12.3.0.... VMware.VimAutomation.Nsxt           {Connect-NsxtServer, Disconnect-NsxtServer, Get-NsxtGlobalManagerService, Get-NsxtPolicyService...}
Script     12.2.0.... VMware.VimAutomation.Sdk            {Get-ErrorReport, Get-PSVersion, EnableParameterCompleters, Get-InstallPath}
Script     12.3.0.... VMware.VimAutomation.Security       {Add-AttestationServiceInfo, Add-KeyProviderServiceInfo, Add-TrustAuthorityKeyProviderServer, Add-TrustAuthorityKeyProviderServerCertificate...}
Script     12.3.0.... VMware.VimAutomation.Srm            {Connect-SrmServer, Disconnect-SrmServer}
Script     12.3.0.... VMware.VimAutomation.Storage        {Add-EntityDefaultKeyProvider, Add-KeyManagementServer, Add-VsanFileServiceOvf, Add-VsanObjectToRepairQueue...}
Script     1.6.0.0    VMware.VimAutomation.StorageUtility Update-VmfsDatastore
Script     12.3.0.... VMware.VimAutomation.Vds            {Add-VDSwitchPhysicalNetworkAdapter, Add-VDSwitchVMHost, Export-VDPortGroup, Export-VDSwitch...}
Script     12.2.0.... VMware.VimAutomation.Vmc            {Add-VmcSddcHost, Connect-Vmc, Disconnect-Vmc, Get-AwsAccount...}
Script     12.2.0.... VMware.VimAutomation.vROps          {Connect-OMServer, Disconnect-OMServer, Get-OMAlert, Get-OMAlertDefinition...}
Script     12.3.0.... VMware.VimAutomation.WorkloadMan... {Disable-WMCluster, Enable-WMCluster, Get-WMCluster, Get-WMNamespace...}
Script     12.1.0.... VMware.VumAutomation                {Add-EntityBaseline, Copy-Patch, Get-Baseline, Get-Compliance...}
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership

Then you are probably experiencing the same issue as mentioned in the other thread I linked to earlier.

You could try setting the culture to en-US, and check if that fixes the issue.
Note that you need to run the PS session as Administrator for this cmdlet

Set-Culture en-US


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

View solution in original post

0 Kudos
11 Replies
LucD
Leadership
Leadership

I just tested that in PSv5.1 and PSV7.1.3, both against a vSphere 7 environment, and the Get-Stat cmdlet worked correctly in both cases.

It might be a regional settings issue, as already mentioned in Solved: Get-Stat CMDLET Error - VMware Technology Network VMTN


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

0 Kudos
ITenGriTR
Contributor
Contributor

How i can set ?

 

i have

VMWare Esxi 6.7.0 Update 3 (Build 14320388)

VMware vCenter Server Appliance 6.7.0.10000

PowerShell:

Name Value
---- -----
PSVersion 5.1.17763.1
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.1
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

0 Kudos
LucD
Leadership
Leadership

What does Get-Culture return?


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

0 Kudos
ITenGriTR
Contributor
Contributor

Returning

LCID Name DisplayName
---- ---- -----------
1055 tr-TR Turkish (Turkey)

0 Kudos
LucD
Leadership
Leadership

Then you are probably experiencing the same issue as mentioned in the other thread I linked to earlier.

You could try setting the culture to en-US, and check if that fixes the issue.
Note that you need to run the PS session as Administrator for this cmdlet

Set-Culture en-US


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

0 Kudos
ITenGriTR
Contributor
Contributor

I cant change

 

PS C:\Users\Administrator> Set-Culture en-US
PS C:\Users\Administrator> Get-Culture

LCID Name DisplayName
---- ---- -----------
1055 tr-TR Turkish (Turkey)

0 Kudos
LucD
Leadership
Leadership

Are you running the PS session as Administrator?


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

0 Kudos
ITenGriTR
Contributor
Contributor

yes

0 Kudos
ITenGriTR
Contributor
Contributor

I changed culture with difrent method and changed now

 

LCID Name DisplayName
---- ---- -----------
1033 en-US English (United States)

0 Kudos
LucD
Leadership
Leadership

And did you restart your PS session?


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

0 Kudos
ITenGriTR
Contributor
Contributor

and its working perfectly thank you 

0 Kudos