ארכיון פוסטים מהחודש "נובמבר, 2016"

VSphere Export Configuration

יום שני, 21 בנובמבר, 2016

סקריפט להוציא קונפיגורציה של Vsphere Networking

 

&{foreach($esx in Get-VMHost){
    $vNicTab = @{}
    $esx.ExtensionData.Config.Network.Vnic | %{
        $vNicTab.Add($_.Portgroup,$_)
    }
    foreach($vsw in (Get-VirtualSwitch -VMHost $esx)){
        foreach($pg in (Get-VirtualPortGroup -VirtualSwitch $vsw)){
            Select -InputObject $pg -Property @{N="ESX";E={$esx.name}},
                @{N="vSwitch";E={$vsw.Name}},
                @{N="NIC";E={if($vsw.Nic){[string]::Join(',',$vsw.Nic)}}},
                @{N="Portgroup";E={$pg.Name}},
                @{N="VLAN";E={$pg.VLanId}},
                @{N="Device";E={if($vNicTab.ContainsKey($pg.Name)){$vNicTab[$pg.Name].Device}}},
                @{N="IP";E={if($vNicTab.ContainsKey($pg.Name)){$vNicTab[$pg.Name].Spec.Ip.IpAddress}}}
        }
    }
}} | Export-Csv report.csv -NoTypeInformation -UseCulture

יום שני, 21 בנובמבר, 2016

Vsphere Power Cli Export all network configuration example

&{foreach($esx in Get-VMHost){
$vNicTab = @{}
$esx.ExtensionData.Config.Network.Vnic | %{
$vNicTab.Add($_.Portgroup,$_)
}
foreach($vsw in (Get-VirtualSwitch -VMHost $esx)){
foreach($pg in (Get-VirtualPortGroup -VirtualSwitch $vsw)){
Select -InputObject $pg -Property @{N="ESX";E={$esx.name}},
@{N="vSwitch";E={$vsw.Name}},
@{N="NIC";E={if($vsw.Nic){[string]::Join(',',$vsw.Nic)}}},
@{N="Portgroup";E={$pg.Name}},
@{N="VLAN";E={$pg.VLanId}},
@{N="Device";E={if($vNicTab.ContainsKey($pg.Name)){$vNicTab[$pg.Name].Device}}},
@{N="IP";E={if($vNicTab.ContainsKey($pg.Name)){$vNicTab[$pg.Name].Spec.Ip.IpAddress}}}
}
}
}} | Export-Csv report.csv -NoTypeInformation -UseCulture