Automation

 View Only
Expand all | Collapse all

Cannot find any way to change network adapter speed in Powercli

  • 1.  Cannot find any way to change network adapter speed in Powercli

    Posted Aug 18, 2020 09:26 PM

    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

    Thanks in advance

    Brian



  • 2.  RE: Cannot find any way to change network adapter speed in Powercli
    Best Answer

    Posted Aug 19, 2020 06:35 AM

    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)



  • 3.  RE: Cannot find any way to change network adapter speed in Powercli

    Posted Aug 19, 2020 07:13 PM

    Again, Thank you LucD