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) {
$nicInfo = [PSCustomObject]@{ if ($vm.nics.count -gt 0) {
VPGName = $group.VPGName foreach ($nic in $vm.nics) {
VMName = $vmMap[$($vm.vmIdentifier)] $nicInfo = [PSCustomObject]@{
NicIdentifier = $vm.nics.NicIdentifier VPGName = $group.VPGName
LiveNetwork = $networkMap[$vm.nics.failover.Hypervisor.NetworkIdentifier] VMName = $vmMap[$vm.vmIdentifier]
LiveShouldReplaceMac = $vm.nics.failover.Hypervisor.ShouldReplaceMacAddress NicIdentifier = $nic.NicIdentifier
LiveIsDHCP = $vm.Nics.failover.Hypervisor.IpConfig.IsDhcp LiveNetwork = $networkMap[$nic.failover.Hypervisor.NetworkIdentifier]
LiveIpAddress = $vm.nics.failover.Hypervisor.IpConfig.StaticIp LiveShouldReplaceMac = $nic.failover.Hypervisor.ShouldReplaceMacAddress
LiveIpSubnetMask = $vm.nics.failover.Hypervisor.IpConfig.SubnetMask LiveIsDHCP = $nic.failover.Hypervisor.IpConfig.IsDhcp
LiveIpDefaultGateway = $vm.nics.failover.Hypervisor.IpConfig.Gateway LiveIpAddress = $nic.failover.Hypervisor.IpConfig.StaticIp
LivePrimaryDns = $vm.nics.failover.Hypervisor.IpConfig.PrimaryDns LiveIpSubnetMask = $nic.failover.Hypervisor.IpConfig.SubnetMask
LiveSecondayDns = $vm.nics.failover.Hypervisor.IpConfig.SecondaryDns LiveIpDefaultGateway = $nic.failover.Hypervisor.IpConfig.Gateway
LiveDnsSuffix = $vm.nics.failover.Hypervisor.DnsSuffix LivePrimaryDns = $nic.failover.Hypervisor.IpConfig.PrimaryDns
TestNetwork = $networkMap[$vm.nics.failoverTest.Hypervisor.NetworkIdentifier] LiveSecondayDns = $nic.failover.Hypervisor.IpConfig.SecondaryDns
TestShouldReplaceMac = $vm.nics.failoverTest.Hypervisor.ShouldReplaceMacAddress LiveDnsSuffix = $nic.failover.Hypervisor.DnsSuffix
TestIsDHCP = $vm.Nics.failoverTest.Hypervisor.IpConfig.IsDhcp TestNetwork = $networkMap[$nic.failoverTest.Hypervisor.NetworkIdentifier]
TestIpAddress = $vm.nics.failoverTest.Hypervisor.IpConfig.StaticIp TestShouldReplaceMac = $nic.failoverTest.Hypervisor.ShouldReplaceMacAddress
TestIpSubnetMask = $vm.nics.failoverTest.Hypervisor.IpConfig.SubnetMask TestIsDHCP = $nic.failoverTest.Hypervisor.IpConfig.IsDhcp
TestIpDefaultGateway = $vm.nics.failoverTest.Hypervisor.IpConfig.Gateway TestIpAddress = $nic.failoverTest.Hypervisor.IpConfig.StaticIp
TestPrimaryDns = $vm.nics.failoverTest.Hypervisor.IpConfig.PrimaryDns TestIpSubnetMask = $nic.failoverTest.Hypervisor.IpConfig.SubnetMask
TestSecondayDns = $vm.nics.failoverTest.Hypervisor.IpConfig.SecondaryDns TestIpDefaultGateway = $nic.failoverTest.Hypervisor.IpConfig.Gateway
TestDnsSuffix = $vm.nics.failoverTest.Hypervisor.DnsSuffix TestPrimaryDns = $nic.failoverTest.Hypervisor.IpConfig.PrimaryDns
TestSecondayDns = $nic.failoverTest.Hypervisor.IpConfig.SecondaryDns
TestDnsSuffix = $nic.failoverTest.Hypervisor.DnsSuffix
}
$nicInfo
}
} }
$nicInfo
} }
} }
$nicSettings | Export-Csv -Path $OutputFile $nicSettings | Export-Csv -Path $OutputFile -NoTypeInformation
} }
end { end {