Export portgroup from the host

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Export portgroup from the host相关的知识,希望对你有一定的参考价值。

Script

----------------------------------------------------------------------------------

Add-PSSnapin vmWARE.VimAutomation.Core

$vc="devvc55"
connect-viserver $vc
$date = Get-Date -Format ‘yyyyMMdd‘


 $VLANinfo = foreach ($cluster in get-cluster)
       {
            foreach ($esx in (Get-VMHost -Location $cluster))
       {
            foreach ($pg in (Get-VirtualPortGroup -VMHost $esx))
 
       {
         Select-Object -InputObject $pg -Property @{N="Cluster"; E={$cluster.Name}},
                                    @{N="VMhost";  E={$esx.Name}},
                                    @{N="VirtualSwitchName"; E={$pg.VirtualSwitchName}},
                                    @{N="portgroup"; E={$pg.Name}},
                                    @{N="VLAN";      E={$pg.VlanID}}
                }
                }
                }

$VLANinfo | Export-Csv "C:\PS\report\$($vc)_allPortGroup_$date.csv"

以上是关于Export portgroup from the host的主要内容,如果未能解决你的问题,请参考以下文章

Copy vSwith portgroup from an existing ESXi host

Can’t import the named export ‘bypassFilter’ from non EcmaScript module (only default export is avai

ES2015 import & export

es6 export-from用法

Scripts for configure portgroup

Add PortGroup to all hosts in cluster with PowerCLI