私は次のようなことをしようとしています:
Get-WmiObject Win32_NetworkAdapterConfiguration `
-Filter "DefaultIPGateway!=NULL"
しかし、私はエラーがあります:
Get-WmiObject : 無効なクエリ 行:1 char:14 + Get-WmiObject <<<< Win32_NetworkAdapterConfiguration -Filter "DefaultIPGateway!=NULL" + CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException + FullyQualifiedErrorId : GetWMIManagementException, Microsoft.PowerShell.Commands.GetWmiObjectCommand
DefaultIPGateway の値の型を取得しようとすると、奇妙です。既存の値の System.Array です。
PS> $result[0].DefaultIPGateway.Gettype()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True String[] System.Array
そして、存在しない値の NULL:
PS> $result[1].DefaultIPGateway.GetType()
You cannot call a method on a null-valued expression.
At line:1 char:36
+ $result[1].DefaultIPGateway.GetType <<<< ()
+ CategoryInfo : InvalidOperation: (GetType:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
WQL が機能しない理由と、それを機能させるにはどうすればよいかを理解するのに誰か助けてもらえますか?