Hi
I have 10 to 20 vms, they are not connected to network, when i checked the status for device the adapter was unchecked for
connected & connect at power on, how could i enable ( make a check mark) on them using the script ? they are on dhcp.
Thank you.
Try this
Get-VM | Get-NetworkAdapter | Set-NetworkAdapter -StartConnected:$true -Connected:$true
See the Set-NetworkAdapter cmdlet for more info.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Try this
Get-VM | Get-NetworkAdapter | Set-NetworkAdapter -StartConnected:$true -Connected:$true
See the Set-NetworkAdapter cmdlet for more info.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks - it works, i had a do a small change to filter the vmk network. .....:)
Get-VM | Get-NetworkAdapter | Where { $_.NetworkName -eq "VM Network" } |
Set-NetworkAdapter -StartConnected:$true -Connected:$true
is it possible to add 2nd NIC (adapter type: vmxnet3) and remove 1st NIC or uncheck the connected/connect at power on?
That should be possible.
Have a look at the New-NetworkAdapter cmdlet. With the -Type parameter you can select a vmxnet3 card.
You can remove the first NIC with the Remove-NetworkAdapter cmdlet. But I would advise to do this when the guest is powered off.
The alternative is to change the StartConnected option with the Set-NetworkAdapter cmdlet.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference