简体   繁体   English

如何以编程方式连接到 Windows 10 中的隐藏 SSID?

[英]How do I connect to a hidden SSID in Windows 10 programmatically?

I have spent ages on this and I am stuck.我在这上面花了很长时间,但我被困住了。
I am trying to connect to a known hidden SSID programmatically.我正在尝试以编程方式连接到已知的隐藏 SSID。

I am using the following code我正在使用以下代码

await firstAdapter.ScanAsync();

WiFiAvailableNetwork network = firstAdapter.NetworkReport.AvailableNetworks.FirstOrDefault(n => n.Ssid == ssid);

The problem is I need to supply as a first an object of type WiFiAvailableNetwork but AvailableNetworks only brings back non-hidden SSIDs.问题是我需要首先提供WiFiAvailableNetwork类型的对象,但AvailableNetworks只带回非隐藏的 SSID。

public IAsyncOperation<WiFiConnectionResult> ConnectAsync(WiFiAvailableNetwork availableNetwork, WiFiReconnectionKind reconnectionKind, PasswordCredential passwordCredential, String ssid)

https://docs.microsoft.com/en-us/uwp/api/windows.devices.wifi.wifiadapter.connectasync#Windows_Devices_WiFi_WiFiAdapter_ConnectAsync_Windows_Devices_WiFi_WiFiAvailableNetwork_Windows_Devices_WiFi_WiFiReconnectionKind_Windows_Security_Credentials_PasswordCredential_System_String_ https://docs.microsoft.com/en-us/uwp/api/windows.devices.wifi.wifiadapter.connectasync#Windows_Devices_WiFi_WiFiAdapter_ConnectAsync_Windows_Devices_WiFi_WiFiAvailableNetwork_Windows_Devices_WiFi_WiFiReconnectionKind_Windows_Security_Credentials_PasswordCredential_System_String_

The above code works perfectly with non-hidden SSID's.上面的代码与非隐藏的 SSID 完美配合。
Is there an API to connect to a hidden SSID?是否有连接到隐藏 SSID 的 API?
Thanks谢谢

If available, the hidden network should be in the firstAdapter.NetworkReport.AvailableNetworks list.如果可用,隐藏网络应该在firstAdapter.NetworkReport.AvailableNetworks列表中。

As the SSID is hidden, the Ssid property of WiFiAvailableNetwork for the target network will be "" .由于 SSID 是隐藏的,目标网络的WiFiAvailableNetworkSsid属性将为""

You could make an assumption here and attempt to connect to it using:您可以在此处进行假设并尝试使用以下方法连接到它:

await firstAdapter.ConnectAsync(networks.First(x => x.Ssid == ""), WiFiReconnectionKind.Automatic, "password", "knownSSID");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何以编程方式确定Windows任务栏是否隐藏? - How can I determine programmatically whether the Windows taskbar is hidden or not? 如何以编程方式创建Windows窗体? - How do I programmatically create a windows form? 如何以编程方式在Windows 7中的Windows资源管理器中打开“库”文件夹? - How do I programmatically open the “Libraries” folder in Windows Explorer in Windows 7? 如何以编程方式复制在Windows下锁定的文件或文件夹? - How do I copy a file or folder that is locked under windows programmatically? 如何以编程方式自动从Windows资源管理器中打开文件 - How do I automate the opening of a file from Windows Explorer programmatically 如何以编程方式设置Windows服务的权限? - How do I programmatically set a permission to a windows service? 如何在 Windows 10 中以编程方式调用触摸屏校准工具 - How to programmatically call the touch screen calibration tool in Windows 10 如何以编程方式连接到 VPN? - How can I programmatically connect to a VPN? 为什么我在尝试使用.Net PowerShell Runspace 连接到我的本地 Windows 10 机器时会出现异常? - Why do I get exceptions when trying to use .Net PowerShell Runspace to connect to my local Windows 10 machine? 尝试以编程方式连接时,如何在SFTP服务器上接受警告消息 - How do I accept warning message on SFTP server when trying to connect programmatically
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM