【发布时间】:2022-01-22 02:35:54
【问题描述】:
我正在尝试自动获取 WiFi 名称和密码。 我最大的问题是以 system.array 格式解析输出。因为我不能简单地通过它的键访问值。我正在寻找一种方法来确保在不同的 PC 上运行时解析不会停止。
> $all_profiles = netsh wlan show profile
> $all_profiles
Profiles on interface Wi-Fi:
Group policy profiles (read only)
---------------------------------
<None>
User profiles
-------------
All User Profile : GRUBISIC
All User Profile : HUAWEI
All User Profile : A1
All User Profile : Ma
All User Profile : Ka
All User Profile : Ou
All User Profile : GK_Si
All User Profile : 93
All User Profile : 9B
All User Profile : Li
All User Profile : A
All User Profile : NETI
All User Profile : Re
All User Profile : Chu
> $all_profiles.GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Object[] System.Array
现在我想将其解析为配置文件名称列表,因此:[GRUBISIC, HUAWEI ...]
【问题讨论】:
标签: powershell automation scripting system.array