VMware Cloud Community
bbarbee9
Contributor
Contributor
Jump to solution

Cannot find any way to change network adapter speed in Powercli

Hi,

I have been lookin thru the powerCLI reference located here

Online Documentation - Cmdlet Reference - VMware {code}

I see the command Set-NetworkAdapter, but I do not see anyway to control speed.

Here is a screenshot of what settings I am trying to modify

Reservation and Limit.JPG

Thanks in advance

Brian

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

No cmdlet for that, you'll have to use the API.

Something like this for example.

Note that the values need to be in Mbps

$vmName = 'MyVM'

$nicName = 'Network adapter 1'


$limitGbps = 8

$reservationGbps = 2


$vm = Get-VM -Name $vmName

$nic = Get-NetworkAdapter -VM $vm -Name $nicName

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec

$dev = New-Object VMware.Vim.VirtualDeviceConfigSpec

$dev.Operation = [VMware.Vim.VirtualDeviceConfigSpecOperation]::edit

$dev.Device = $nic.ExtensionData

$dev.Device.ResourceAllocation.Limit = $limitGbps * 1KB

$dev.Device.ResourceAllocation.Reservation = $reservationGbps * 1KB

$spec.DeviceChange += $dev


$vm.ExtensionData.ReconfigVM($spec)


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

View solution in original post

2 Replies
LucD
Leadership
Leadership
Jump to solution

No cmdlet for that, you'll have to use the API.

Something like this for example.

Note that the values need to be in Mbps

$vmName = 'MyVM'

$nicName = 'Network adapter 1'


$limitGbps = 8

$reservationGbps = 2


$vm = Get-VM -Name $vmName

$nic = Get-NetworkAdapter -VM $vm -Name $nicName

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec

$dev = New-Object VMware.Vim.VirtualDeviceConfigSpec

$dev.Operation = [VMware.Vim.VirtualDeviceConfigSpecOperation]::edit

$dev.Device = $nic.ExtensionData

$dev.Device.ResourceAllocation.Limit = $limitGbps * 1KB

$dev.Device.ResourceAllocation.Reservation = $reservationGbps * 1KB

$spec.DeviceChange += $dev


$vm.ExtensionData.ReconfigVM($spec)


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

bbarbee9
Contributor
Contributor
Jump to solution

Again, Thank you LucD

Reply
0 Kudos