使用 Get-NetAdapter 遍历数组以检查名称是否正确
Loop through array to check for the correct name using Get-NetAdapter
最近我整理了一个脚本,可以从计算机收集一些数据。
在提取此数据时,其中一些数据按名称排序。
$BTMacAdress = $(Get-NetAdapter -Name "Bluetooth Network Connection").MacAddress
当您在西班牙语机器上使用此脚本时,名称将更改为“Conexión de red Bluetooth”。
我用不同语言的所有连接名称创建了一个数组。我怎样才能让它遍历数组并检查数组中的名称是否正确?
我尝试用数组代替“蓝牙网络连接”,但收效甚微。
按媒体类型过滤
Get-NetAdapter | where PhysicalMediaType -eq "Bluetooth"
这当然也适用于您的使用方式:
$BTMacAdress = (Get-NetAdapter | where PhysicalMediaType -eq "Bluetooth").MacAddress
最近我整理了一个脚本,可以从计算机收集一些数据。 在提取此数据时,其中一些数据按名称排序。
$BTMacAdress = $(Get-NetAdapter -Name "Bluetooth Network Connection").MacAddress
当您在西班牙语机器上使用此脚本时,名称将更改为“Conexión de red Bluetooth”。
我用不同语言的所有连接名称创建了一个数组。我怎样才能让它遍历数组并检查数组中的名称是否正确?
我尝试用数组代替“蓝牙网络连接”,但收效甚微。
按媒体类型过滤
Get-NetAdapter | where PhysicalMediaType -eq "Bluetooth"
这当然也适用于您的使用方式:
$BTMacAdress = (Get-NetAdapter | where PhysicalMediaType -eq "Bluetooth").MacAddress