Powershell WMI ROOT \ MicrosoftExchangev2和WQL(使用情况) [英] Powershell WMI ROOT\MicrosoftExchangev2, and WQL where usage

查看:180
本文介绍了Powershell WMI ROOT \ MicrosoftExchangev2和WQL(使用情况)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(PS版本1)

PS C:\> $query = 'Select * From Exchange_PublicFolder WHERE Path LIKE "/Foo%"'
PS C:\> $query
Select * From Exchange_PublicFolder WHERE Path LIKE "/Foo%"
PS C:\> gwmi -namespace ROOT\MicrosoftExchangev2 -query $query
Get-WmiObject : Provider is not capable of the attempted operation
At line:1 char:5
+ gwmi  <<<< -namespace ROOT\MicrosoftExchangev2 -query $query

如果我尝试先不将查询分配给变量,这没有什么区别. WQL关键字WHERE可能有问题吗?我可以在没有查询的情况下运行查询:

It makes no difference if I try to assign the query to a variable first or not. Is there might be a problem with the WQL keyword WHERE? I can run a query without it just fine:

PS C:\> (gwmi -namespace ROOT\MicrosoftExchangev2 -query  "Select * From Exchange_PublicFolder").count
711

稍后在管道中进行过滤并不是什么大问题,但是我正在尝试找出我在这里做错了什么:)

It wouldn't be a huge deal to filter later in the pipeline, but I'm trying to figure out what I'm doing wrong here :)

推荐答案

我不认为您做错了什么,只是提供程序无法处理您的查询(错误状态).似乎不支持对任何属性使用LIKE,可以使用"=",但这不是您想要的:(. IMO,在这种情况下使用Where-Object是方法.

I don't think you're doing something wrong, it's just that the provider is not capable of processing your query (as the error states). It seems that using LIKE against any property is not supported, you can use "=" but it's not what you're looking for :(. IMO, using Where-Object is the way to go in this case.

这篇关于Powershell WMI ROOT \ MicrosoftExchangev2和WQL(使用情况)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆