I am looking to search for specific network adapters within our infrastructure. I have been using this command.
$vms = get-vm ; foreach ($vm in $vms) {write-host $vm.Name "-" $vm.networkadapters[0].type }
I would like to filter this to look for the flexible network adapter. After all of the network adapters have been found, we are looking to find an automated way to change all of the flexible drivers. If anyone can help me with filtering out the flexible drivers, it would be greatly appreciated.
Thanks
The next PowerCLI script lists all the virtual machines with Flexible type network adapters:
Get-VM | Get-NetworkAdapter | Where-Object { $_.Type -eq "Flexible"} | ` Select @{N="VM";E={$_.Parent}},@{N="Network Adapter";E={$_.Name}},Type
If you want to change the network adapter type for all the Flexible network adapters to Vmxnet3 you can do this with the next script:
Get-VM | Get-NetworkAdapter | Where-Object { $_.Type -eq "Flexible"} | ` Set-NetworkAdapter -Type Vmxnet3 -Confirm:$false
Regards, Robert
Message was edited by: RvdNieuwendijk Added the second script
The next PowerCLI script lists all the virtual machines with Flexible type network adapters:
Get-VM | Get-NetworkAdapter | Where-Object { $_.Type -eq "Flexible"} | ` Select @{N="VM";E={$_.Parent}},@{N="Network Adapter";E={$_.Name}},Type
If you want to change the network adapter type for all the Flexible network adapters to Vmxnet3 you can do this with the next script:
Get-VM | Get-NetworkAdapter | Where-Object { $_.Type -eq "Flexible"} | ` Set-NetworkAdapter -Type Vmxnet3 -Confirm:$false
Regards, Robert
Message was edited by: RvdNieuwendijk Added the second script
Warning, depending on the OS you run in the guest, it will recognise this NIC typechange as a new NIC.
As a consequence your IP settings will be gone
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you both very much the filter worked very well.