- Joined
- Jul 4, 2015
- Messages
- 8,999
- Thread Author
- #1
Many times people may have both their wireless NIC and wired NIC connected at the same time. This can create a bridge and cause your network performance to degrade. Here is a powershell script that could be setup as a scheduled task to run at start up. What it does it detect if the wired nic is connected and if so it will disable the wireless connections. The -Filter parameters may need to be tweaked to match your network adapter names though.
Code:
Function Get-WiredStatus
{
$nics = Get-WmiObject -Class Win32_NetworkAdapter -Filter "Name LIKE '%Ethernet%'"
ForEach ($nic In $nics)
{
If ($nic.NetConnectionStatus -eq 2)
{
Disable-WirelessConnection
break
}
Else
{
Enable-WirelessConnection
break
}
}
}
Function Disable-WirelessConnection
{
$nics = Get-WmiObject -Class Win32_NetworkAdapter -Filter "Name LIKE '%Wireless%'"
ForEach ($nic In $nics)
{
$nic.Disable() >> $null
}
$nics.Dispose()
}
Function Enable-WirelessConnection
{
$nics = Get-WmiObject -Class Win32_NetworkAdapter -Filter "Name LIKE '%Wireless%'"
ForEach ($nic In $nics)
{
$nic.Enable() >> $null
}
$nics.Dispose()
}
While($true)
{
Get-WiredStatus
Start-Sleep -Seconds 5
}