VMware Cloud Community
VicMware
Contributor
Contributor

Powercli for network adapters

1. I need to remove all network cards of a VM, the problem is I dont know how many network cards this VM has. Does anyone know how to write a script for it?

2. New-NetworkAdapter -VM $vm -NetworkName "VM Network" -WakeOnLan -StartConnected

     Is WakeOnLan enabled by default if I add the network card manually from VI Client?

Reply
0 Kudos
1 Reply
LucD
Leadership
Leadership

1) Try something like this

Get-VM MyVM | Get-NetworkAdapter | Remove-NetworkAdapter -Confirm:$false 

2) Yes. But there are some problems with WOL and the E1000 NIC, use the VMXNET3 if you want to use WOL


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

Reply
0 Kudos