VMware Cloud Community
AlbertWT
Virtuoso
Virtuoso
Jump to solution

PowerCLI to extract all vSwitch network info to CSV

Hi People,

Can anyone please assist me with the PowerCLi script to be executed against one VCenter server to gather each VMHost (ESX & ESXi) Networking configuration as in Configuration tab | Networking | View: vSphere Standard Switch

For Example here as follows:

ESX01

  vSwitch0, vmnic3, vmnic4

  Service Console 2

  vmk2: 10.1.1.4 | VLAN 1

  Management Network

  vmk1: 10.1.2.1 | VLAN 2

  VMotion

  vmk2: 10.1.3.1 | VLAN 3

  vSwitch1, vmnic2, vmnic1 vmnic0

  VLAN 45

  VLAN 12

  MS Cluster Heart Beat Network

  VLAN 8

ESX02

  vSwitch0, vmnic3, vmnic4

  Service Console 2

  vmk2: 10.2.1.4 | VLAN 1

  Management Network

  vmk1: 10.2.2.1 | VLAN 2

  VMotion

  vmk2: 10.2.3.1 | VLAN 3

  vSwitch1, vmnic2, vmnic1 vmnic0

  VLAN 45

  VLAN 12

  MS Cluster Heart Beat Network

  VLAN 8

...

Any type of format will do in CSV as long as the information can be used to create the vSwitch manually on each ESX host.

This is just in case I need to rebuild one of the ESX / ESXi host in the event of the ESX to ESXi upgrade went wrong which requires me to rebuild the server from scratch.

Cheers,

Al

/* Please feel free to provide any comments or input you may have. */
Tags (3)
26 Replies
bansne
Enthusiast
Enthusiast
Jump to solution

ok I will have different thread open for same then.

Reply
0 Kudos
AlbertWT
Virtuoso
Virtuoso
Jump to solution

Many thanks for the sharing @Lucd, this is a great helpful script.

/* Please feel free to provide any comments or input you may have. */
Reply
0 Kudos
AlbertWT
Virtuoso
Virtuoso
Jump to solution

Let us know what's the thread location bansne

/* Please feel free to provide any comments or input you may have. */
Reply
0 Kudos
AlbertWT
Virtuoso
Virtuoso
Jump to solution

vmCalgary, the script result shows Device and IPSw column blank?

is that expected or something may have gone wrong with my cluster environment?

/* Please feel free to provide any comments or input you may have. */
Reply
0 Kudos
bansne
Enthusiast
Enthusiast
Jump to solution

Reply
0 Kudos
pcavallaMIT
Contributor
Contributor
Jump to solution

LucD,

Thank you for these posts, they are very useful.  

Is there a similar script that will also show distributed switches on an active/active or active/passive view.  

Exact output as your original script but includes the dVS info as well.

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Reply
0 Kudos