Hi,
I need to reconfigure all VM interfaces from one dvSwitch to another in a specified cluster. The other
dvSwitch already exist but the port groups are named are a bit different as you can't have the same named per vCenter. Can I somehow do it by VLAN ID? The
source dvSwitch is LACP and the destination is not, we are moving off LACP..
Thanks..
As a proof of concept, would the following not work?
The values for OldPG and NewPG can be obtained from a CSV, and the code can be placed in a loop over all the portgroups that need to be migrated.
If you have VMs with more than 1 vNIC, the code needs to be expanded a bit.
Get-NetworkAdapter |
Set-NetworkAdapter -NetworkName NewPg -Confirm:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
What is Get-VDPortgroup returning?
And how would your CSV file look like?
With some sample data if possible.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Name NumPorts PortBinding
---- -------- -----------
Inter-PCT-Cluster-3128 128 Static
Inter-PCT-Cluster-3117 128 Static
Inter-PCT-Cluster-3118 128 Static
dv02-OEM-QA-RAC-3162 128 Static
Inter-PCT-Cluster-3119 128 Static
dv02-DMZ-CORP-NPCI-LB-VLAN-551 150 Static
dv02-DMZ-CORP-PCI-LB-VLAN-651 128 Static
dv02-DMZ-CORP-NPCI-NFS-2551 128 Static
dv02-DMZ-CORP-PCI-NFS-2651 128 Static
dv02-DMZ-CUP-PCI-DMZ-672 128 Static
dv02-DMZ-LEGACY-NFS-VLAN-300 128 Static
dv02-DMZ-NPCI-CAT2-DMZ-641 16 Static
dv02-DMZ-NPCI-CAT3-DMZ-VIP-520 128 Static
dv02-DMZ-NPCI-CAT3-DMZ-WEB-521 128 Static
dv02-DMZ-NPCI-LB-VLAN-571 128 Static
dv02-DMZ-NPCI-NFS-2571 128 Static
dv02-DMZ-PCI-LB-VLAN-671 128 Static
dvSwitch02-T-DVUplinks-103 228 Static
dv02-DMZ-PCI-NFS-2671 128 Static
dv02-DMZ-QA-NFS-VLAN-100 128 Static
dv02-DMZ-S2NP-NPCI-LB-VLAN-573 128 Static
dv02-DMZ-S2NP-NPCI-NFS-2573 128 Static
dv02-DMZ-SRVC-PCI-LB-VLAN-689 128 Static
dv02-DMZ-SRVC-PCI-NFS-2689 128 Static
dv02-AFI-TE-QA-3116 128 Static
dv02-APP_PCI_SRV_ACE-VLAN-409 128 Static
dv02-GITT-VSC-LLT-3073 128 Static
dv02-HSTG-RA-CJ-3140 128 Static
dv02-HSTG-RA-HIAS-3139 128 Static
dv01-LAB-RAC-3167 128 Static
dv01-LAB-RAC-3168 128 Static
dv01-LAB-RAC-3169 128 Static
dv01-LAB-RAC-3170 128 Static
dv01-LAB-RAC-3171 128 Static
dv01-LAB-RAC-3172 128 Static
dv01-LAB-RAC-3173 128 Static
dv01-LAB-RAC-3174 128 Static
dv02-UT-NPCI-CAT2-NFS-DMZ-2641 128 Static
dv02-UT-NPCI-CAT3-NFS-DMZ-2521 128 Static
NGDC-UATP-QA-3133 128 Static
dv02-HSTG-RA-VGR-3138 128 Static
dv02-HZN-HMIG-RA-3143 128 Static
dv02-HZN-HMIG-RA-3144 128 Static
dv02-HZN-HMIG-RA-3145 128 Static
dv02-HZN-HMIG-RA-3147 128 Static
dv02-WTR-QA-DB-RAC-3 128 Static
dv02-WTR-QA-DB-RAC-2 128 Static
dv02-WTR-QA-DB-RAC-1 128 Static
dv02-WTR-STG-DB-RAC-3 128 Static
dv02-WTR-STG-DB-RAC-2 128 Static
dv02-WTR-STG-DB-RAC-1 128 Static
dv02-HZN-WIT-RFR-DEV-3141 128 Static
dv02-HZN-WIT-RFR-DEV-3142 128 Static
SIM-ANSIBLE-TOWER-DB-3165 8 Static
dv02-Inter-PCI-Cluster-3078 128 Static
dv02-Inter-PCI-Cluster-3079 128 Static
dv02-Inter-PCI-Cluster-3117 128 Static
HSTG-RA-VGR-3138 128 Static
dv02-Inter-PCI-Cluster-3118 128 Static
dv02-Inter-PCI-Cluster-3119 128 Static
dv02-Inter-PCI-Cluster-3128 128 Static
dv02-LEGACY-NFS-VLAN-300 128 Static
dv02-Main-WTR-Cluster-3069 128 Static
dv02-Main-WTR-Cluster-3080 128 Static
dv02-NGDC-UATP-DEV-3127 128 Static
dv02-NGDC-UATP-QA-3133 128 Static
dv02-NGDC-UATP-QA-POC-3123 128 Static
dv02-SRDT-QA-3109 128 Static
HSTG-RA-HIAS-3139 128 Static
dv02-T-App1_SRV_ACE-VLAN-411 259 Static
dv02-T-CORP-NPCI-DB-NFS-2260 128 Static
dv02-T-CORP-NPCI-DB-VLAN-260 128 Static
dv02-T-CORP-NPCI-LB-VLAN-201 128 Static
dv02-T-CORP-NPCI-NFS-2201 128 Static
dv02-T-CORP-PCI-DB-NFS-2460 128 Static
dv02-T-CORP-PCI-DB-VLAN-460 128 Static
dv02-T-CORP-PCI-LB-VLAN-401 128 Static
dv02-T-CORP-PCI-NFS-2401 128 Static
dv02-T-NGDC-UATP-DEV-3124 128 Static
HSTG-RA-CJ-3140 128 Static
dv02-T-NGDC-UATP-QA-3125 128 Static
dv02-T-NPCI-DB-NFS-2261 128 Static
dv02-T-NPCI-DB-VLAN-261 128 Static
dv02-T-NPCI-LB-VLAN-221 285 Static
dv02-T-NPCI-NFS-2221 265 Static
dv02-T-PCI-DB-NFS-2461 128 Static
dv02-T-PCI-LB-VLAN-421 365 Static
dv02-T-PCI-DB-VLAN-461 128 Static
dv02-T-PCI-NFS-2421 345 Static
dv02-T-S2NP-NPCI-DB-NFS-2262 128 Static
T-VOYA-PCI-APP-NFS-2411 128 Static
dv02-T-S2NP-NPCI-DB-VLAN-262 128 Static
dv02-T-S2NP-NPCI-LB-VLAN-223 176 Static
dv02-T-S2NP-NPCI-NFS-2223 176 Static
dv02-T-SRVC-PCI-LB-VLAN-489 128 Static
dv02-T-SRVC-PCI-NFS-2489 128 Static
dv02-T-VAVX-PCI-DBN-462 128 Static
dv02-T-VAVX-PCI-DB-NFS-2462 128 Static
dv02-T-Voyager_DB_PCI-VLAN-463 128 Static
dv02-T-VOYA-PCI-APP-NFS-2411 254 Static
dv02-T-VOYA-PCI-DB-NFS-2463 128 Static
HZN-WIT-RFR-DEV-3141 128 Static
dv02-T-Windows-Cluster-3093 128 Static
dv02-T-Windows-Cluster-3094 128 Static
dv02-T-WTR-Training-Cluster... 128 Static
dv02-T-WTR-Training-Cluster... 128 Static
dv02-QA-NFS-VLAN-100 128 Static
dv02-VM-FT-VLAN-318 128 Static
dv02-vMotion-VLAN-317 128 Static
dv02-T-NPCI-DEV-APP-SRVR-224 128 Static
dv02-T-NPCI-DEV-DB-SRVR-263 128 Static
dv02-T-NPCI-DEV-APP-SRVR-NF... 128 Static
HZN-WIT-RFR-DEV-3142 128 Static
dv02-T-NPCI-DEV-DB-SRVR-NFS... 128 Static
dv02-HZN-WIT2-RA-3150 128 Static
dv02-HZN-WIT2-RA-3151 128 Static
dv02-HZN-WIT2-RA-3152 128 Static
dv02-HZN-WIT2-RA-3153 128 Static
dv02-DatastoreNFS-VLAN-2315 128 Static
dv02-INFRA-SRVCS-PCI-351 128 Static
dv02-INFRA-SRVCS-NPCI-361 128 Static
dv02-INFRA-SRVCS-PCI-NFS-2351 128 Static
dv02-INFRA-SRVCS-NPCI-NFS-2361 128 Static
HZN-HMIG-RA-3143 128 Static
dv02-T-CORP-PCI-400 128 Static
HZN-HMIG-RA-3144 128 Static
HZN-HMIG-RA-3145 128 Static
HZN-HMIG-RA-3147 128 Static
MSGWY-QA-3148 128 Static
T-NPCI-DEV-APP-SRVR-224 128 Static
T-NPCI-DEV-DB-SRVR-263 128 Static
T-NPCI-DEV-APP-SRVR-NFS-2224 128 Static
T-NPCI-DEV-DB-SRVR-NFS-2263 128 Static
HZN-WIT2-RA-3150 128 Static
HZN-WIT2-RA-3151 128 Static
HZN-WIT2-RA-3152 128 Static
HZN-WIT2-RA-3153 128 Static
DatastoreNFS-VLAN-2315 136 Static
INFRA-SRVCS-NPCI-361 128 Static
INFRA-SRVCS-NPCI-NFS-2361 128 Static
QA-NFS-VLAN-100 512 Static
LEGACY-NFS-VLAN-300 128 Static
VMMgmt-VLAN-315 128 Static
T-CORP-NPCI-LB-VLAN-201 256 Static
T-NPCI-LB-VLAN-221 512 Static
Data_Guard-RAC_PRV-VLAN-3011 8 Static
Data_Guard-RAC_PRV-VLAN-3012 8 Static
dv02-Data_Guard-RAC_PRV-VLA... 8 Static
dv02-Data_Guard-RAC_PRV-VLA... 8 Static
vSAN-VLAN-337 128 Static
T-S2NP-NPCI-LB-VLAN-223 128 Static
VM-FT-VLAN-338 128 Static
T-CORP-NPCI-DB-VLAN-260 128 Static
VM-Mgmt-VLAN-335 128 Static
T-PCI-LB-VLAN-421 512 Static
T-NPCI-DB-VLAN-261 128 Static
T-CORP-PCI-DB-VLAN-460 128 Static
T-S2NP-NPCI-DB-VLAN-262 128 Static
T-PCI-DB-VLAN-461 128 Static
T-CORP-PCI-LB-VLAN-401 128 Static
Voyager_DB_PCI-VLAN-463 128 Static
APP_PCI_SRV_ACE-VLAN-409 128 Static
T-SRVC-PCI-LB-VLAN-489 128 Static
T-App1_SRV_ACE-VLAN-411 512 Static
T-CORP-NPCI-NFS-2201 128 Static
T-NPCI-NFS-2221 512 Static
T-S2NP-NPCI-NFS-2223 128 Static
T-CORP-NPCI-DB-NFS-2260 128 Static
T-PCI-DB-NFS-2461 128 Static
T-NPCI-DB-NFS-2261 128 Static
T-VAVX-PCI-DB-NFS-2462 128 Static
T-S2NP-NPCI-DB-NFS-2262 128 Static
T-VOYA-PCI-DB-NFS-2463 128 Static
T-CORP-PCI-NFS-2401 128 Static
dvSwitch02-UT-DVUplinks-6555 0 Static
dv02-UT-CORP-NPCI-LB-VLAN-551 150 Static
dv02-UT-CORP-NPCI-NFS-2551 128 Static
dv02-UT-CORP-PCI-LB-VLAN-651 128 Static
dv02-UT-CORP-PCI-NFS-2651 128 Static
dv02-UT-DatastoreNFS-VLAN-2315 128 Static
dv02-UT-LEGACY-NFS-VLAN-300 128 Static
dv02-UT-NPCI-LB-VLAN-571 128 Static
dv02-UT-NPCI-NFS-2571 128 Static
dv02-UT-PCI-LB-VLAN-671 128 Static
dv02-UT-PCI-NFS-2671 128 Static
dv02-UT-QA-NFS-VLAN-100 128 Static
dv02-UT-S2NP-NPCI-LB-VLAN-573 128 Static
dv02-UT-S2NP-NPCI-NFS-2573 128 Static
dv02-UT-SRVC-PCI-LB-VLAN-689 128 Static
dv02-UT-SRVC-PCI-NFS-2689 128 Static
dv02-UT-VM-FT-VLAN-318 128 Static
dv02-UT-VM-FT-VLAN-338 128 Static
dv02-UT-VMotion-VLAN-317 128 Static
dv02-UT-VMotion-VLAN-337 128 Static
T-VAVX-PCI-DBN-462 128 Static
T-SRVC-PCI-NFS-2489 128 Static
T-PCI-NFS-2421 512 Static
T-CORP-PCI-DB-NFS-2460 128 Static
T-CORP-PCI-400 128 Static
Control-VLAN-328 128 Static
Packet-VLAN-327 128 Static
VM-FT-VLAN-318 128 Static
VMotion-VLAN-317 128 Static
VCenterMgmt-VLAN-319 128 Static
Windows-CLuster-3093 128 Static
Windows-CLuster-3094 128 Static
dv02-VCenterMgmt-VLAN-319 63 Static
dv02-Windows-Cluster-3093 8 Static
dv02-Windows-Cluster-3094 8 Static
tmp-UT-CORP-NPCI-LB-VLAN-571 128 Static
dvSwitch01-T-DVUplinks-7 56 Static
GITT-VCS-LLT-3073 128 Static
tmp-UT-PCI-LB-VLAN-671 128 Static
dv02-MSGWY-QA-3148 8 Static
dv02-T-CUP-PCI-APP-422 128 Static
dv02-T-CUP-PCI-DB-464 128 Static
dv02-T-CUP-PCI-HSM-62 128 Static
dv02-T-PCI-HSM-TRANSIT-931 128 Static
dv02-UT-CUP-PCI-DMZ-672 128 Static
tmp-UT-PCI-NFS-2671 128 Static
tmp-UT-NPCI-NFS-2571 128 Static
dv02-WTR-Web-Cluster-3071 8 Static
dv02-WTR-Web-Cluster-3082 8 Static
dv02-RAC-ORACLE-TESTING-3154 8 Static
AFI-TE-QA-3116 128 Static
dv02-HZN-WITRA-3155 128 Static
NGDC-UATP-QA-POC-3123 128 Static
dv02-HZN-ITRAVEL-QA2-3156 128 Static
TOOLS-PCI-352 8 Static
TOOLS-PCI-NFS-2352 8 Static
TOOLS-NPCI-362 8 Static
TOOLS-NPCI-NFS-2362 8 Static
dv02-TOOLS-PCI-352 35 Static
dv02-TOOLS-PCI-NFS-2352 16 Static
dv02-TOOLS-NPCI-362 8 Static
dv02-TOOLS-NPCI-NFS-2362 8 Static
Inter-PCT-Cluster-3079 128 Static
Main-WTR-Cluster-3080 128 Static
SRDT-QA-3109 128 Static
dv02-T-MF-MZ-A-387 8 Static
dv02-T-MF-MZ-B-388 8 Static
dv02-T-MF-VLAN-380 128 Static
Inter-PCT-Cluster-3078 128 Static
NGDC-UATP-DEV-3127 128 Static
Main-WTR-Cluster-3069 128 Static
WTR-Training-Cluster-3070 128 Static
dv02-T-MF-MZ-NFS-2387 128 Static
WTR-Training-Cluster-3081 128 Static
WTR-Web-Cluster-3082 128 Static
WTR-Web-Cluster-3071 128 Static
VSM05_Mgmt-VLAN-335 128 Static
HZN-ORACLE-DATA-GUARD-3016 8 Static
dv02-HZN-ORACLE-DATA-GUARD-... 8 Static
VSM05_CTRL-VLAN-336 128 Static
VSM05_PCKT-VLAN-345 128 Static
dv02-CAT2-APP-NFS-VLAN-2441 128 Static
dv02-CAT2-APP-VLAN-441 128 Static
T-NGDC-UATP-DEV-3124 128 Static
dv02-DB-PATCH-VALIDATION-RA... 128 Static
dv02-UT-NPCI-CAT3-DMZ-VIP-520 128 Static
dv02-UT-NPCI-CAT3-DMZ-WEB-521 128 Static
dv02-netscout-test 8 Static
dv02-SFS-DB-RAC1-3160 128 Static
dv02-SFS-DB-RAC2-3161 128 Static
T-NGDC-UATP-QA-3125 128 Static
dv02-UT-NPCI-CAT2-DMZ-641 128 Static
dv02-Tax-DB-RAC-3157 128 Static
dv02-DB-PATCH-VALIDATION-RA... 128 Static
All the ones named dv02-* would go away after we move off LACP. Ideally i'd import a .CSV of VM's, which would then look up the corresponding VLAN for each VM on dvSwitch02 and then move the VM's interfaces to dvSwitch01
As a proof of concept, would the following not work?
The values for OldPG and NewPG can be obtained from a CSV, and the code can be placed in a loop over all the portgroups that need to be migrated.
If you have VMs with more than 1 vNIC, the code needs to be expanded a bit.
Get-NetworkAdapter |
Set-NetworkAdapter -NetworkName NewPg -Confirm:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I'll give that a go, Thanks so much!!