GED125 GED125 - 1 month ago 18
C# Question

C# Programmatically Disable Large Send Offload (LSO)

We deploy an application that requires several specific NIC related configuration changes. One of these changes is disabling "Large Send Offload V2" or "LSO" from all NIC's. Is there a way to do this programmatically with C# and .NET? I would like to write a simple Console or Forms based application that can do this automatically. I have been exploring System.Management.ManagementClass, but it does not seem to have these advanced options. Thanks in advance for your assistance.

enter image description here

Answer

I'm not sure of a C# way, but there are PowerShell cmdlets that can do it with Set-NetAdapterAdvancedProperty. I'm not certain which API this uses to make the changes though.

Set-NetAdapterAdvancedProperty Ethernet -DisplayName "Large Send Offload V2 (IPv4)" -DisplayValue "Disabled" -NoRestart