-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
I understand the author doesn't maintain this anymore because he no longer uses these two script files, but there are some issues for those looking to use this in the future:
- The WLANManager.ps1 only detects combination of wired/wireless status, not changes in each status. Therefore this solution is better: Dell's recommendation
- The WLANManager disables or enabled the entire adapter, which is not ideal. It's better to enable or disable the status. PowerShell Example:
Add-Type -AssemblyName System.Runtime.WindowsRuntime
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? {$_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1'})[0]
Function Await($WinRtTask, $ResultType)
{
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
$netTask = $asTask.Invoke($null, @($WinRtTask))
$netTask.Wait(-1) | Out-Null
$netTask.Result
}
[Windows.Devices.Radios.Radio,Windows.System.Devices,ContentType=WindowsRuntime]
[Windows.Devices.Radios.RadioAccessStatus,Windows.System.Devices,ContentType=WindowsRuntime]
Await ([Windows.Devices.Radios.Radio]::RequestAccessAsync()) ([Windows.Devices.Radios.RadioAccessStatus])
$radios = Await ([Windows.Devices.Radios.Radio]::GetRadiosAsync()) ([System.Collections.Generic.IReadOnlyList[Windows.Devices.Radios.Radio]])
$wifi = $radios | ? { $_.Kind -eq 'WiFi' }
[Windows.Devices.Radios.RadioState,Windows.System.Devices,ContentType=WindowsRuntime]Then...
Await ($wifi.SetStateAsync("Off")) ([Windows.Devices.Radios.RadioAccessStatus])... change the the $wifi.SetStateAsync to either "On" or "Off"
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels