'Is there a way to set jumbo frame with C++ in Windows?

My C++ application uses Gige camera on many various Windows 10 PC. So I wanna set jumbo frame of LAN card of PC programmatically. (when the process starts it is enabled and disabled when the end of process.) any helps?



Solution 1:[1]

Thanks to @SimonMourier, I could write power shell command for enables jumbo frames and 1gbps duplex.

// enables.ps1

// Query all network adapter which has 'jumbo frame' property and set it as 9014 bytes.
$jumboFramesList = (Get-NetAdapterAdvancedProperty -RegistryKeyword "*JumboPacket")
foreach($item in $jumboFramesList) {
  Set-NetAdapterAdvancedProperty -DisplayName $item.DisplayName -RegistryValue "9014"
}

// Query all network adapter which has 'speed & duplex' property and set it as 1.0 gbps duplex.
$speedDuplexList = (Get-NetAdapterAdvancedProperty -RegistryKeyword "*SpeedDuplex")
foreach($item in $speedDuplexList ) {
  Set-NetAdapterAdvancedProperty -DisplayName $item.DisplayName -RegistryValue "6"
// Registry 6 means "1.0 Gbps duplex"
}
// reset.ps1
// Reset all network adapters' properties of 'jumbo frames' and 'speed & duplex'

$jumboFramesList = (Get-NetAdapterAdvancedProperty -RegistryKeyword "*JumboPacket")
foreach($item in $jumboFramesList) {
  Reset-NetAdapterAdvancedProperty -Name * -DisplayName $item.DisplayName
}

$speedDuplexList = (Get-NetAdapterAdvancedProperty -RegistryKeyword "*SpeedDuplex")
foreach($item in $speedDuplexList) {
  Reset-NetAdapterAdvancedProperty -Name * -DisplayName $item.DisplayName
}

and I could run above script files in my application when I need it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 WOOSEOK CHOI