WLAN Manager

WLAN Manager runs as a scheduled task and will automatically disable your WLAN card when a LAN connection is verified. The WLAN card will be re-enabled once the LAN connection is lost. This ensures you'll have the fastest available connection and helps prevent network bridging.

WLANManager.zip
 
 
 
 
 
4.3 Star
(21)
12,765 times
Add to favorites
Networking
5/8/2015
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Updates
    2 Posts | Last post April 23, 2019
    • Hi,
      
      this is great but I propose three changes:
      
      1. Check for Version >=8 as number not text, currently it will not use the Win8 syntax on Windows 10.
      
      2. Event triggers instead of startup: event id 27 and 32 from SYSTEM are pretty good indications for network changes and that also means the script doesn't have to run forever, which it will not.
      Doing eventid natively in PS is pretty cumbersome, as there is no eventid-trigger from logs to add.
      
      3. With the trigger, the loop can be removed.
      
      I've done all that manually (for system) and so far it works.
      
      -Roland
      
      
    • Roland could you plese provide modified script or short explanation how to do this?
  • Openvpn restart
    1 Posts | Last post October 25, 2018
    • What and where to add the script to after LAN_off+Wlan_On and Wlan_off+LAN_ON was restart the OpenVPN service (OpenVPNService)?
  • Condition causing any issue?
    1 Posts | Last post October 18, 2018
    • The default condition for the task scheduler is to stop the running task after 3 days.  If a user doesn't reboot their machine within three days, doesn't this get in the way of the process working? 
  • Updating for VPN
    1 Posts | Last post October 18, 2018
    • To work with things like VPN (Cisco and Fortinet) and HyperV, update these two lines in the .psm1 file.
      
      $NetworkConnectionsLAN = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "IPEnabled=TRUE" | Where-Object {($_.Description -notlike "*VirtualBox*") -and ($_.Description -notlike "Hyper-V Virtual*") -and ($_.Description -notlike "Cisco AnyConnect*") -and ($_.Description -notlike "*VPN*") -and ($_.Description -notlike "*VMware*") -and ($_.Description -notlike "*Wireless*") -and ($_.Description -notlike "*WiFi*") -and ($_.Description -notlike "*Wi-Fi*")}
      
      $NetworkConnectionsWLAN = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "IPEnabled=TRUE" | Where-Object {($_.Description -notlike "*VirtualBox*") -and ($_.Description -notlike "Hyper-V Virtual*") -and ($_.Description -notlike "*VMware*")  -and ($_.Description -notlike "Cisco AnyConnect*") -and ($_.Description -notlike "*VPN*") -and (($_.Description -like "*Wireless*") -or ($_.Description -like "*WiFi*") -or ($_.Description -like "*Wi-Fi*"))}
      
      
  • VPN
    1 Posts | Last post August 01, 2018
    • Please help, I don't not where to add this line to exclude VPN:
      -and ($_.Description -notlike "Cisco AnyConnect VPN Client Connection"
      
      Other than VPN it works great.
      
      Thanks,
      Kevin
  • I cannot seem to install
    1 Posts | Last post July 04, 2018
    • Everything appears fine until
      
      Get-ScheduledTask : No MSFT_ScheduledTask objects found with property 'TaskName' equal to 'WLAN Manager'.  Verify the
      value of the property and retry.
      At C:\temp\Install-WLANManager-master\PSModule-WLANManager.psm1:411 char:18
      + ...        If ((Get-ScheduledTask -TaskName "$TaskName" -ErrorAction Cont ...
      +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : ObjectNotFound: (WLAN Manager:String) [Get-ScheduledTask], CimJobException
          + FullyQualifiedErrorId : CmdletizationQuery_NotFound_TaskName,Get-ScheduledTask
      
      IT isn't creating the scheduled task and doesn't copy the files either
  • Deployment using SCCM
    1 Posts | Last post July 04, 2018
    • Hi,
      WLAN Manager manual installation works fine.
      But using a SCCM task sequence to deploy it, I've this error message at the final report:
      "The variable cannot be validated because the value  is not a valid value for the Remove variable. At D:\Deploy\Scripts\WLANManager\WLANManager.ps1:123 char:1.
      + Set-Variable -Name Remove -Value $Remove -Scope Global -Force".
      Nevertheless, WLAN Manager seems to works fine.
      How to correct this error message please?
  • Trying to deploy to remote computers
    5 Posts | Last post June 26, 2018
    • I'm able to use the script if I am logged in to a workstation, import the module, and run the WLANManager.ps1 -install:system command and it works just fine. When I try to deploy it to remote computers (using PDQDeploy) everything looks like it is working but then I get the below errors in the output log. 
      
      Verifying WLAN Manager version information... Missing
      Writing WLAN Manager version information... Done
      Verify WLAN Manager Files... Missing
      Installing WLAN Manager Files... Done
      Verify WLAN Manager Scheduled Task... Exception calling "GetTask" with "1" argument(s): "The system cannot find the file specified. (Exception from HRESULT: 0x80070002)"
      At C:\WINDOWS\AdminArsenal\PDQDeployRunner\service-1\exec\Error Handling Wrapper.ps1:39 char:18
      + Invoke-Expression <<<<  "& '.\$($Parameters[0])' $($Parameters[1])"
      
      Any help would be appreciated. 
    • Hi Craftbeerkzoo
      
      I've updated the script here:
      https://github.com/jchristens/Install-WLANManager
      
      This works on PDQ for me; the error you're describing should be solved.
      
      Let me know if it's not working.
      
      Cheers
    • I copied the New Files as I also use PDQ.  When I use their powershell step I get a different error now. 
      VERBOSE: Loading module from path 'C:\WINDOWS\AdminArsenal\PDQDeployRunner\service-1\exec\PSModule-WLANManager.psm1'.
      At C:\WINDOWS\AdminArsenal\PDQDeployRunner\service-1\exec\PSModule-WLANManager.psm1:27 char:103
      + ... Win32_NetworkAdapter | Where-Object {($_.Description -notlike “*Vir ...
      +                                                                  ~
      You must provide a value expression following the '-notlike' operator.
      At C:\WINDOWS\AdminArsenal\PDQDeployRunner\service-1\exec\PSModule-WLANManager.psm1:27 char:104
      + ... r | Where-Object {($_.Description -notlike “*VirtualBox*”) -and ( ...
      +                                                ~~~~~~~~~~~~~~~~~~
      Unexpected token '“*VirtualBox*”' in expression or statement.
      At C:\WINDOWS\AdminArsenal\PDQDeployRunner\service-1\exec\PSModule-WLANManager.psm1:27 char:103
      + ... Win32_NetworkAdapter | Where-Object {($_.Description -notlike “*Vir ...
      +                                                                  ~
      Missing closing ')' in expression.
      At C:\WINDOWS\AdminArsenal\PDQDeployRunner\service-1\exec\PSModule-WLANManager.psm1:27 char:78
      + ...  = Get-WmiObject -Class Win32_NetworkAdapter | Where-Object {($_.Desc ...
      +                                                                 ~
      Missing closing '}' in statement block or type definition.
      At C:\WINDOWS\AdminArsenal\PDQDeployRunner\service-1\exec\PSModule-WLANManager.psm1:25 char:1
      + {
      + ~
      Missing closing '}' in statement block or type definition.
      At C:\WINDOWS\AdminArsenal\PDQDeployRunner\service-1\exec\PSModule-WLANManager.psm1:27 char:122
      + ...  | Where-Object {($_.Description -notlike “*VirtualBox*”) -and ($ ...
      +                                                                 ~
      Unexpected token ')' in expression or statement.
      At C:\WINDOWS\AdminArsenal\PDQDeployRunner\service-1\exec\PSModule-WLANManager.psm
    • Well, I fixed that issue, for some reason it changed to those Weird Symbols when importing. 
      So all appears to be working well!   Windows 10 does act differently though.  One Windows 7 it seems to disabled the Wifi Nic.  In Windows 10 is actually disconnects the wireless but doesn't disable, once you unplug it just connects back to wireless!  Pretty awesome. 
    • Hi Dan Sadler,
      I am having a heck of a time deploying this with PDQ. What did you do to fix it?  The failure log in PDQ shows the same odd symbols that you had.
      I have never done a PS script with PDQ an I am trying a three step progress.
      1) mkdir C:\Windows\System32\WindowsPowerShell\v1.0\Modules\PSModule-WLANManager
      2) Import-module \\server\Software\WLANManager\PSModule-WLANManager.psm1
      3) Run the powershell script:   & '.\WLANManager.ps1'
  • CPU Usage
    1 Posts | Last post June 14, 2018
    • Hi, I love the script and I got it to work via VPN thanks to a previous suggestion.
      We wanted to deploy this for all our users,
      but I have the impression it is pretty heavy on the CPU.
      Besides powershell you have the networking server "WmiPrvSE.exe" that is constantly working.
      It's always in the top of high CPU processes.
      I'm guessing there is no way around this?
  • VPN confusion
    3 Posts | Last post May 02, 2018
    • I was very excited about this script.  I tested it on my machine, and it seemed to work well until I connected to a VPN with wireless.  The script was confusing the VPN connection with a wired connection.  After having the VPN connected while on wireless I would have an endless loop which would:
      
      * Drop my wireless connection because it saw the VPN and decided that was a wireless connection
      * Once the wireless connection was disabled, the VPN connection interface would shut down because it cannot reach the network, and start retrying to connect
      * The script would detect that the VPN adapter was down (since it couldn't reach the network) and reconnect to wireless
      * Once wireless was reconnected the VPN would auto reconnect and cause the loop to start again.
      
      Such a promising script, but unfortunately not currently usable with VPN connections.
    • That first bullet was supposed to say:
      
      * Drop my wireless connection because it saw the VPN and decided that was a wired connection
      
    • Hi Dave - we had the same issue, but it is easily fixed. In the module you need to add an exclusion in for your VPN solution. In the Test-WiredConnection function you can add an extra
      
      -and ($_.Description -notlike "*INSERT_YOUR_VPN*"
      
      In our case we added "*juniper*" and all was good. :)
1 - 10 of 52 Items