Automation

 View Only
  • 1.  PowerCLI Reference functions failing

    Posted Oct 18, 2013 03:27 PM

    Can someone help me determine why functions from the PowerCLI reference book fail on this line?

    $perfMgr = Get-View (Get-View ServiceInstance).content.perfManager

    The error is:

    Get-View : Cannot validate argument on parameter 'VIObject'. The argument is null or empty. Supply an argument that is not null or empty and then try the comma

    nd again.

    At line:1 char:20

    + $perfMgr = Get-View <<<<  (Get-View ServiceInstance).content.perfManager

        + CategoryInfo          : InvalidData: (:) [Get-View], ParameterBindingValidationException

        + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView



  • 2.  RE: PowerCLI Reference functions failing

    Posted Oct 19, 2013 10:35 AM

    Are you connected to a vSphere server (ESXi or vCenter) ?

    Check by displaying the content of

    $global:defaultVIServers

    If that doesn't return anything, you will have to use the Connect-VIServer cmdlet to connect to an ESXi server or a vCenter.



  • 3.  RE: PowerCLI Reference functions failing

    Posted Oct 19, 2013 10:59 PM

    Thank you for your reply. Yes, I am connected to a vCenter session when this happens. I can run other cmdlets fine.



  • 4.  RE: PowerCLI Reference functions failing

    Posted Oct 20, 2013 12:12 AM

    Ok, does

    Get-View ServiceInstance

    return anything ?