仿照例子:似乎无法识别<code>Get-Help about_Type_Operators</code>型
PS C:\> (get-culture) -is [System.Globalization.CultureInfo]
True
我试图做的只是用不同的类型一样的东西。为什么这会失败?我从Get-TypeData
的输出中复制了类型名称。
(我的道歉使用is
代替-is
原来的问题。)
这个建议没有工作。
PS C:\> (Get-WMIObject -Class Win32_BIOS) -is [System.Management.ManagementObject#root\cimv2\Win32_BIOS]
Unable to find type [System.Management.ManagementObject#root\cimv2\Win32_BIOS].
At line:1 char:1
+ (Get-WMIObject -Class Win32_BIOS) -is [System.Management.ManagementOb ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Manageme...imv2\Win32_BIOS:TypeName)
[], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
在相关说明中,这些每个的目的是什么?
PS C:\> Get-TypeData | Where-Object {$_.TypeName -like '*Win32_BIOS' }
TypeName Members
-------- -------
System.Management.ManagementObject#root\cimv2\Win32_BIOS {}
Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_BIOS {}
投票结束为一个简单的错字。你的情况下,gwmi对象的基类型是'(Get-WmiObject -Class win32_bios)-is [System.Management.ManagementBaseObject]' – Matt
@Matt - 是的,这是有效的。因此,我们无法检查它是否是Win32_BIOS类型,如'Get-WmiObject -Class win32_bios | gm'? – lit