0
需要获取有关网络接口的一些信息:转换PowerShell的对象JSON,在特定的IP地址
> Get-NetIPConfiguration | select IPv4Address, InterfaceAlias, InterfaceDes cription | ConvertTo-Json
回应
[
{
"IPv4Address": [
"MSFT_NetIPAddress (Name = \";C?8;@B8CC8;??55;:55;55;\", CreationClassName = \"\", SystemCr
eationClassName = \"\", SystemName = \"\")"
],
"InterfaceAlias": "wifi",
"InterfaceDescription": "Qualcomm Atheros AR5BWB222 Wireless Network Adapter"
},
{
"IPv4Address": [
"MSFT_NetIPAddress (Name = \";@C8???8;??8??B55;@55;55;\", CreationClassName = \"\", SystemC
reationClassName = \"\", SystemName = \"\")"
],
"InterfaceAlias": "Ethernet",
"InterfaceDescription": "Realtek PCIe GBE Family Controller"
}
]
这看起来像自叹不如。我希望是这样的:
[
{
"IPv4Address": "12.3.3.4",
"InterfaceAlias": "wifi",
"InterfaceDescription": "Qualcomm Atheros AR5BWB222 Wireless Network Adapter"
"NetAdapter.Status" : "connected"
},
{
"IPv4Address": "192.168.0.1",
"InterfaceAlias": "Ethernet",
"InterfaceDescription": "Realtek PCIe GBE Family Controller"
"NetAdapter.Status" : "connected"
}
]
还需要获取接口状态连接或断开,它存储在NetAdapter.Status
。 请帮忙。最好把它写在一行中。
谢谢你,这似乎是接近,但不是我所寻找的。 – kyb