VMware Cloud Community
pspacek
Contributor
Contributor
Jump to solution

Remove VMkernel adapter on vDS

I am in need of a powercli script to remove a specific VMkernel adapter on a ESXi 6.5 host on a Distributed Switch.

I am targeting the vmk1 which also has 'vmotion' enabled.

This script snippet works but I need to target the adapter by either having vmotion enabled or by the device name "vmk1"

$network = Get-VMHostNetwork

Remove-VMHostNetworkAdapter $network.VirtualNic[0] -Confirm

Any help would be great.

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

With the vmkernel name, you can do

Get-VMHostNetworkAdapter -VMKernel -Name vmk1 -VMHost $esx |

Remove-VMHostNetworkAdapter -Confirm:$false

You can also target the one(s) where vMotion is enabled.

Get-VMHostNetworkAdapter -VMKernel -VMHost $esx |

where{$_.VMotionEnabled} |

Remove-VMHostNetworkAdapter -Confirm:$false

---------------------------------------------------------------------------------------------------------

Was it helpful? Let us know by completing this short survey here.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
1 Reply
LucD
Leadership
Leadership
Jump to solution

With the vmkernel name, you can do

Get-VMHostNetworkAdapter -VMKernel -Name vmk1 -VMHost $esx |

Remove-VMHostNetworkAdapter -Confirm:$false

You can also target the one(s) where vMotion is enabled.

Get-VMHostNetworkAdapter -VMKernel -VMHost $esx |

where{$_.VMotionEnabled} |

Remove-VMHostNetworkAdapter -Confirm:$false

---------------------------------------------------------------------------------------------------------

Was it helpful? Let us know by completing this short survey here.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos