Skip to content

Instantly share code, notes, and snippets.

@chriskyfung
Last active April 21, 2024 00:10
Show Gist options
  • Save chriskyfung/073e0fbfeeb7b5c1e7d13dc94d638bb9 to your computer and use it in GitHub Desktop.
Save chriskyfung/073e0fbfeeb7b5c1e7d13dc94d638bb9 to your computer and use it in GitHub Desktop.
PowerShell Script to Optimize Virtual Ethernet Adapter Performance for BlueStacks with Hyper-V Enabled
#Requires -RunAsAdministrator
Try {
# Disable all Virtual Ethernet Adapters except the Virtual Ethernet Adapter for BlueStacks
Get-NetAdapter -Name "vEthernet *" | where Name -inotmatch ‘BluestacksNxt’ | Disable-NetAdapter -Confirm:$false
# Ensure the Virtual Ethernet Adapter for BlueStacks is active
Enable-NetAdapter -Name "vEthernet (BluestacksNxt)"
# Disable Large Send Offload (LSO) for all Virtual Ethernet Adapters. Learn more: https://learn.microsoft.com/en-us/windows-hardware/drivers/network/performance-in-network-adapters#supporting-large-send-offload-lso
Disable-NetAdapterLso -Name "vEthernet (*)"
# Disable Receive side scaling (RSS) for all Virtual Ethernet Adapters. Learn more: https://learn.microsoft.com/en-us/windows-hardware/drivers/network/introduction-to-receive-side-scaling?source=recommendations
Disable-NetAdapterRss -Name "vEthernet (*)"
# Disable Receive segment coalescing (RSC) for all Virtual Ethernet Adapters. Learn more: https://learn.microsoft.com/en-us/windows-hardware/drivers/network/overview-of-receive-segment-coalescing
Disable-NetAdapterRsc -Name "vEthernet (*)"
# List all acitve network adapters
(Get-NetAdapter | where status -eq ‘up’ | Format-List -Property Name, InterfaceDescription, Status | Out-String).TrimEnd()
Write-Host "`nvEthernet (BluestacksNxt) - Large Send Offload (LSO):`n"
(Get-NetAdapterLso -Name "vEthernet (BluestacksNxt)" | Format-List -Property "*Enabled" | Out-String).Trim()
Write-Host "`nvEthernet (BluestacksNxt) - Receive Side Scaling (RSS):`n"
(Get-NetAdapterRss -Name "vEthernet (BluestacksNxt)" | Format-List -Property "Enabled" | Out-String).Trim()
Write-Host "`nvEthernet (BluestacksNxt) - Receive Segment Coalescing (RSC):`n"
(Get-NetAdapterRsc -Name "vEthernet (BluestacksNxt)" | Format-List -Property "*Enabled" | Out-String).Trim()
Write-Host "`n"
} Catch {
Write-Host "An error occurred:"
Write-Host $_
}
@chriskyfung
Copy link
Author

Example Output

Name                 : Ethernet
InterfaceDescription : Intel(R) Ethernet Connection (2) I219-V
Status               : Up

Name                 : vEthernet (BluestacksNxt)
InterfaceDescription : Hyper-V Virtual Ethernet Adapter #3
Status               : Up

vEthernet (BluestacksNxt) - Large Send Offload (LSO):

IPv4Enabled   : False
IPv6Enabled   : False
V1IPv4Enabled : False

vEthernet (BluestacksNxt) - Receive Side Scaling (RSS):

Enabled : False

vEthernet (BluestacksNxt) - Receive Segment Coalescing (RSC):

IPv4Enabled : False
IPv6Enabled : False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment