<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to batch execute the following queries on ESXi hosts through Powercli in VMware PowerCLI Discussions</title>
    <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-batch-execute-the-following-queries-on-ESXi-hosts-through/m-p/2977072#M112625</link>
    <description>&lt;P&gt;How to batch execute the following queries on ESXi hosts through Powercli: vsish - e get/vmkModules/vsanutil/stretchedClusterMode&lt;BR /&gt;Or other ways, thank you guys!&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jul 2023 07:28:04 GMT</pubDate>
    <dc:creator>thiefqw</dc:creator>
    <dc:date>2023-07-13T07:28:04Z</dc:date>
    <item>
      <title>How to batch execute the following queries on ESXi hosts through Powercli</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-batch-execute-the-following-queries-on-ESXi-hosts-through/m-p/2977072#M112625</link>
      <description>&lt;P&gt;How to batch execute the following queries on ESXi hosts through Powercli: vsish - e get/vmkModules/vsanutil/stretchedClusterMode&lt;BR /&gt;Or other ways, thank you guys!&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2023 07:28:04 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-batch-execute-the-following-queries-on-ESXi-hosts-through/m-p/2977072#M112625</guid>
      <dc:creator>thiefqw</dc:creator>
      <dc:date>2023-07-13T07:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to batch execute the following queries on ESXi hosts through Powercli</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-batch-execute-the-following-queries-on-ESXi-hosts-through/m-p/2977097#M112626</link>
      <description>&lt;P&gt;Not directly an alternative for that &lt;STRONG&gt;vsish&lt;/STRONG&gt; command, but you can check if the VSAM cluster has a preferred default domain.&lt;BR /&gt;With Get-EsxCli.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;Get-Cluster -PipelineVariable cluster |
ForEach-Object -Process {
   Write-Host "Cluster $($cluster.Name)  VMHost $($esx.Name)"
   $esx = Get-VMHost -Location $cluster | Get-Random -Count 1
   $esxcli = Get-EsxCli -VMHost $esx -V2
   $uuid = $esxcli.vsan.cluster.list.Invoke().LocalNodeUUID
   try{
      if($esxcli.vsan.cluster.preferredfaultdomain.get.Invoke(@{clusteruuid = $uuid }) 2&amp;gt; $null ){
         Write-Host "Stretched cluster"
      }

   }
   catch{
      Write-Host "Not a stretched cluster"
   }
}&lt;/LI-CODE&gt;
&lt;P&gt;Or via the Get-VsanView cmdlet&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;$sc = Get-VsanView -Id 'VimClusterVsanVcStretchedClusterSystem-vsan-stretched-cluster-system'

Get-Cluster -PipelineVariable cluster |
ForEach-Object -Process {
	Write-Host "Cluster $($cluster.Name)"
	$pd = $sc.VSANVcGetPreferredFaultDomain($cluster.Id)
	if($pd.preferredfaultdomain){
			Write-Host "Stretched cluster"
  }
	else {
		Write-Host "Not a stretched cluster"
	}
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2023 08:45:08 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/How-to-batch-execute-the-following-queries-on-ESXi-hosts-through/m-p/2977097#M112626</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2023-07-13T08:45:08Z</dc:date>
    </item>
  </channel>
</rss>

