C++基础入门教程(六):为什么创建类的时候要用new?
2026/10/20 13:31:39
在处理 WMI 高级功能时,PowerShell 自带的[Wmi]、[WmiClass]和[WmiSearcher]加速器可能无法直接满足需求。此时,可以通过对象的PsBase属性,利用其 .NET 接口来与之交互。
示例代码:
## If they want us to match on property names, check if their text ## matches the property name if($matchOptions -contains "PropertyName") { if($property.Name -match $pattern) { New-WmiMatch "PropertyName" ` $managementClass.Name $property.Name $property.Name } } ## If they want us to match on property descriptions, check if ## their text matches the property name if($matchOptions -contains "PropertyDescription") {