VMware Cloud Community
ewannema
Enthusiast
Enthusiast

Finding current time on a host - destType error

I am successfully getting the ServiceInstance, but a call to CurrentTime blows up. The API lists no parameters aside from the reference to _this. Anybody get this working or have a place for me to start figuring it out?

PS C:\> http://Reflection.Assembly::LoadWithPartialName("vmware.vim")

GAC Version Location

--- -


-


True v2.0.50727 C:\WINDOWS\assembly\GAC_MSIL\VMware.Vim\1.0.0.0__10980b081e887e9f\VMware.Vim.dll

PS C:\> $svcRef = new-object VMware.Vim.ManagedObjectReference

PS C:\> $svcRef.Type = "ServiceInstance"

PS C:\> $svcRef.Value = "ServiceInstance"

PS C:\> $serviceInstance = get-view $svcRef

PS C:\> $serviceInstance.CurrentTime()

Exception calling "CurrentTime" with "0" argument(s): "Value cannot be null. Parameter name: destType" At line:1 char:29 + $serviceInstance.CurrentTime( <<<< )

http://wannemacher.us
0 Kudos
2 Replies
LucD
Leadership
Leadership

The QueryDateTime method gives the same error.

See


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

ewannema
Enthusiast
Enthusiast

Thanks for sharing my pain Smiley Happy Unfortunately serverClock is not guaranteed to be accurate so it will not work for my purposes. I wanted to periodically check that my servers are accurately updating their time via NTP.

Anyone have an idea as to what the problem is?

http://wannemacher.us
0 Kudos