Johnny
Johnny

Reputation: 56

C# Disable and Reenable wifi

I have 3 wifi at my home, in some rooms I have signal from the 3 routers and If I'm connected to one windows 10 won't change to the strongest wifi. I would like to know a working way to disable and enable wifi that works in windows 10. My code doesn't work in widnows 10.

    SelectQuery wmiQuery = new SelectQuery("SELECT * FROM Win32_NetworkAdapter WHERE NetConnectionId != NULL");
ManagementObjectSearcher searchProcedure = new ManagementObjectSearcher(wmiQuery);
foreach (ManagementObject item in searchProcedure.Get())
{
    if (((string)item["NetConnectionId"]) == "Local Network Connection")
    {
       item.InvokeMethod("Disable", null);
    }
}

Upvotes: 2

Views: 174

Answers (1)

Johnny
Johnny

Reputation: 56

I'm testing Native Wifi with some success, I'll post more results soon

Upvotes: 1

Related Questions