我有这个powershell代码(我没有写它):
$nics = Get-WmiObject Win32_NetworkAdapter -filter "AdapterTypeID = '0' `
AND PhysicalAdapter = 'true' `
AND NOT Description LIKE '%Centrino%' `
AND NOT Description LIKE '%wireless%' `
AND NOT Description LIKE '%WiFi%' `
AND NOT Description LIKE '%Bluetooth%'"
foreach ($nic in $nics)
{
$nicName = $nic.Name
...
}
问题
作者是如何知道NIC具有这些属性的:
换句话说:我如何检查NIC / Other_Device具有的所有属性?
答案 0 :(得分:1)
get-member
或(gm
)为您提供所有属性:
PS C:\Users\bjorn> Get-WmiObject Win32_NetworkAdapter | gm
TypeName: System.Management.ManagementObject#root\cimv2\Win32_NetworkAdapter
Name MemberType Definition
---- ---------- ----------
PSComputerName AliasProperty PSComputerName = __SERVER
Disable Method System.Management.ManagementBaseObject Disable()
Enable Method System.Management.ManagementBaseObject Enable()
Reset Method System.Management.ManagementBaseObject Reset()
SetPowerState Method System.Management.ManagementBaseObject SetPowerState(System.UInt16 PowerState, System.String Time)
AdapterType Property string AdapterType {get;set;}
AdapterTypeId Property uint16 AdapterTypeId {get;set;}
AutoSense Property bool AutoSense {get;set;}
Availability Property uint16 Availability {get;set;}
...
或与... ISESteroids插件: