Quantcast
Channel: VMware Communities : All Content - VMware PowerCLI
Viewing all articles
Browse latest Browse all 16717

VM names showing twice

$
0
0

Hi,

 

Please help, I am seeing VM details twice in the output when connecting multiple vCenters

 

Script

 

Connect-viserver -Server (Get-Content .\VC_Info.txt) > $null

 

$VmInfo = Foreach ($vc in $global:DefaultVIServers) {

    ForEach ($VM in (Get-Folder -Name Universal-Dev -Server $vc | Get-VM -Server $vc)) {

        $VM.Extensiondata.Guest.Disk | Select @{N='vCenter'; E={([uri]$vm.ExtensionData.Client.ServiceUrl).Host}},

            @{N="Name";E={$VM.Name}},

            @{N = "IPAddress";E={$VM.guest.IPAddress[0]}},

            @{N = "VM PowerState";E={@($VM.PowerState)}},

            @{N = "Operating System";E={@($VM.guest.OSFullName)}},

            @{N = "Folder";E={$VM.Folder.Name}}

        }

    }

$VmInfo | ft -auto

 

disconnect-viserver -server * -force -confirm:$false

 

Output

venter6xapp43192.168.3.127PoweredOn Microsoft Windows Server 2016 or later (64-bit) Dev
venter6xapp43192.168.3.127PoweredOn Microsoft Windows Server 2016 or later (64-bit) Dev
venter6xapp39192.168.3.130PoweredOn Microsoft Windows Server 2016 or later (64-bit) Dev
venter6xapp39192.168.3.130PoweredOn Microsoft Windows Server 2016 or later (64-bit) Dev

Viewing all articles
Browse latest Browse all 16717

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>