Automation

 View Only
  • 1.  Working with multiple vCenter servers in PowerCLI

    Posted Jun 11, 2014 05:15 PM

    Set VI server mode to multiple:

    Set-PowerCLIConfiguration -DefaultVIServerMode Multiple -Confirm:$false

    Connect to two vCenter servers:

    Connect-VIServer -server vc1, vc2 -user userid

    Find cluster and not specify VC:

    Get-Datacenter -Cluster clusterA

    Datacenter for cluster is correctly displayed:

    name of datacenter in VC1

    name of datacenter in VC2

    Try to specify which VC to query:

    Get-Datacenter -Cluster cluster -server VC2

    names of three datacenters are returned that does not make sense (only one contains the cluster)

    Trying to figure out how to best work with simultaneous VC connections in a script and dictate which VC I want to run a command against as opposed to disconnecting and reconnecting etc.



  • 2.  RE: Working with multiple vCenter servers in PowerCLI

    Posted Jun 11, 2014 05:35 PM

    Did it actually say "-Cluster cluster" (without the 'a') ?

    And what do the Get-Cluster cmdlets themselves return ?

    Get-Cluster -Name clustera

    Get-Cluster -Name cluster -Server VC2



  • 3.  RE: Working with multiple vCenter servers in PowerCLI

    Posted Jun 11, 2014 06:12 PM

    Sorry, typo on my part (was "sanitizing" the data) - it is clusterA in both commands.

    Get-Cluster comes back with all clusters from the two vCenter servers I'm connected to.

    Thanks!!!!



  • 4.  RE: Working with multiple vCenter servers in PowerCLI

    Posted Jun 11, 2014 06:32 PM

    Even when you do ?

    Get-Cluster -Name cluster -Server VC2



  • 5.  RE: Working with multiple vCenter servers in PowerCLI

    Posted Jun 11, 2014 06:53 PM

    So, when I have a cluster named ClusterA in both VCs and I do a get-cluster -name ClusterA, I get two results for ClusterA.  If I specify either VC with -server VC1 or VC2 I get only one result.  Now, when I add in get-datacenter -cluster ClusterA -server VCA or VCB it returns all datacenters in the VC.



  • 6.  RE: Working with multiple vCenter servers in PowerCLI
    Best Answer

    Posted Jun 11, 2014 08:36 PM

    I think there might be an issue with the cmdlet.

    You are using PowerCLI 5.5 R2 I assume ?

    When you try like this

    Get-Datacenter -Cluster (Get-Cluster -Name ClusterA -Server VC1)

    does it return 1 datacenter or 2 ?



  • 7.  RE: Working with multiple vCenter servers in PowerCLI

    Posted Jun 12, 2014 12:41 PM

    Yes, I'm on 5.5, U2.  That worked and returns only one datacenter.  Not exactly sure why that worked as I view it as boiling down to get-datacenter -cluster clustername, but thank you for this work-around.



  • 8.  RE: Working with multiple vCenter servers in PowerCLI

    Posted Jun 12, 2014 01:00 PM

    Like I said, I think there might be an "issue" with the cmdlet.

    Perhaps someone from the PowerCLI Dev Team could give an explanation ?