Update Nic Object Logic

This commit is contained in:
Wes Carroll
2019-12-18 13:06:11 -05:00
parent 579ba7a063
commit 270470f858
@@ -45,33 +45,37 @@ function Export-ZertoVmNicSetting {
$null = Remove-ZertoVpgSettingsIdentifier -vpgSettingsIdentifier $settingsId $null = Remove-ZertoVpgSettingsIdentifier -vpgSettingsIdentifier $settingsId
$networkMap = Get-Map -InputObject $networks -key "NetworkIdentifier" -value "VirtualizationNetworkName" $networkMap = Get-Map -InputObject $networks -key "NetworkIdentifier" -value "VirtualizationNetworkName"
foreach ($vm in $vmSettings) { foreach ($vm in $vmSettings) {
if ($vm.nics.count -gt 0) {
foreach ($nic in $vm.nics) {
$nicInfo = [PSCustomObject]@{ $nicInfo = [PSCustomObject]@{
VPGName = $group.VPGName VPGName = $group.VPGName
VMName = $vmMap[$($vm.vmIdentifier)] VMName = $vmMap[$vm.vmIdentifier]
NicIdentifier = $vm.nics.NicIdentifier NicIdentifier = $nic.NicIdentifier
LiveNetwork = $networkMap[$vm.nics.failover.Hypervisor.NetworkIdentifier] LiveNetwork = $networkMap[$nic.failover.Hypervisor.NetworkIdentifier]
LiveShouldReplaceMac = $vm.nics.failover.Hypervisor.ShouldReplaceMacAddress LiveShouldReplaceMac = $nic.failover.Hypervisor.ShouldReplaceMacAddress
LiveIsDHCP = $vm.Nics.failover.Hypervisor.IpConfig.IsDhcp LiveIsDHCP = $nic.failover.Hypervisor.IpConfig.IsDhcp
LiveIpAddress = $vm.nics.failover.Hypervisor.IpConfig.StaticIp LiveIpAddress = $nic.failover.Hypervisor.IpConfig.StaticIp
LiveIpSubnetMask = $vm.nics.failover.Hypervisor.IpConfig.SubnetMask LiveIpSubnetMask = $nic.failover.Hypervisor.IpConfig.SubnetMask
LiveIpDefaultGateway = $vm.nics.failover.Hypervisor.IpConfig.Gateway LiveIpDefaultGateway = $nic.failover.Hypervisor.IpConfig.Gateway
LivePrimaryDns = $vm.nics.failover.Hypervisor.IpConfig.PrimaryDns LivePrimaryDns = $nic.failover.Hypervisor.IpConfig.PrimaryDns
LiveSecondayDns = $vm.nics.failover.Hypervisor.IpConfig.SecondaryDns LiveSecondayDns = $nic.failover.Hypervisor.IpConfig.SecondaryDns
LiveDnsSuffix = $vm.nics.failover.Hypervisor.DnsSuffix LiveDnsSuffix = $nic.failover.Hypervisor.DnsSuffix
TestNetwork = $networkMap[$vm.nics.failoverTest.Hypervisor.NetworkIdentifier] TestNetwork = $networkMap[$nic.failoverTest.Hypervisor.NetworkIdentifier]
TestShouldReplaceMac = $vm.nics.failoverTest.Hypervisor.ShouldReplaceMacAddress TestShouldReplaceMac = $nic.failoverTest.Hypervisor.ShouldReplaceMacAddress
TestIsDHCP = $vm.Nics.failoverTest.Hypervisor.IpConfig.IsDhcp TestIsDHCP = $nic.failoverTest.Hypervisor.IpConfig.IsDhcp
TestIpAddress = $vm.nics.failoverTest.Hypervisor.IpConfig.StaticIp TestIpAddress = $nic.failoverTest.Hypervisor.IpConfig.StaticIp
TestIpSubnetMask = $vm.nics.failoverTest.Hypervisor.IpConfig.SubnetMask TestIpSubnetMask = $nic.failoverTest.Hypervisor.IpConfig.SubnetMask
TestIpDefaultGateway = $vm.nics.failoverTest.Hypervisor.IpConfig.Gateway TestIpDefaultGateway = $nic.failoverTest.Hypervisor.IpConfig.Gateway
TestPrimaryDns = $vm.nics.failoverTest.Hypervisor.IpConfig.PrimaryDns TestPrimaryDns = $nic.failoverTest.Hypervisor.IpConfig.PrimaryDns
TestSecondayDns = $vm.nics.failoverTest.Hypervisor.IpConfig.SecondaryDns TestSecondayDns = $nic.failoverTest.Hypervisor.IpConfig.SecondaryDns
TestDnsSuffix = $vm.nics.failoverTest.Hypervisor.DnsSuffix TestDnsSuffix = $nic.failoverTest.Hypervisor.DnsSuffix
} }
$nicInfo $nicInfo
} }
} }
$nicSettings | Export-Csv -Path $OutputFile }
}
$nicSettings | Export-Csv -Path $OutputFile -NoTypeInformation
} }
end { end {