管道 Get-mailbox -filter 进入 Get-mailboxstatistics -filter
Piping Get-mailbox -filter into Get-mailboxstatistics -filter
我正在尝试使用两个命令过滤列表 -
按属性过滤,然后按 "not disconnected" 和 "logged in in the last 90 days." 过滤
尝试类似的方法,但它不起作用。
get-mailbox -filter 'ExtensionCustomAttribute1 -eq $null'|
Get-MailboxStatistics -filter {DisconnectDate -eq $null -and
LastLogonTime -gt (get-date).adddays(-90)}
当我运行;
get-mailbox -filter 'ExtensionCustomAttribute1 -eq $null' |
Get-MailboxStatistics
我得到了结果的第一部分,其中包含我正在寻找的信息 - 我只是无法进一步过滤此列表。即添加 -filter 不起作用。
结果是:
Technet 文档指定过滤器必须使用单引号而不是花括号。
-Filter 'DisconnectDate -ne $null'
这里给出的例子是:https://technet.microsoft.com/en-us/library/bb124612(v=exchg.160).aspx
我之前在过滤 AD 用户时 运行 遇到过这个问题。我不得不假设他们在过去的某个时候改变了他们的标准。
如果你没有成功,你可以尝试使用 where-object 向右过滤...即:
Get-MailboxStatistics | ?{$_.DisconnectDate -ne $null}
如果可行,显然使用前者。
我想说解决您的问题的最佳方法是如前所述通过 where-object 进行过滤。
以下内容应该适合您,尚未经过测试但应该是正确的。
Get-Mailbox -Filter 'ExtensionCustomAttribute1 -eq $null' | Get-MailboxStatistics | where {$_.DisconnectDate -eq $null -and $_.LastLogonTime -gt (Get-Date).AddDays(-90)}
我正在尝试使用两个命令过滤列表 - 按属性过滤,然后按 "not disconnected" 和 "logged in in the last 90 days." 过滤 尝试类似的方法,但它不起作用。
get-mailbox -filter 'ExtensionCustomAttribute1 -eq $null'| Get-MailboxStatistics -filter {DisconnectDate -eq $null -and LastLogonTime -gt (get-date).adddays(-90)}
当我运行;
get-mailbox -filter 'ExtensionCustomAttribute1 -eq $null' | Get-MailboxStatistics
我得到了结果的第一部分,其中包含我正在寻找的信息 - 我只是无法进一步过滤此列表。即添加 -filter 不起作用。
结果是:
Technet 文档指定过滤器必须使用单引号而不是花括号。
-Filter 'DisconnectDate -ne $null'
这里给出的例子是:https://technet.microsoft.com/en-us/library/bb124612(v=exchg.160).aspx
我之前在过滤 AD 用户时 运行 遇到过这个问题。我不得不假设他们在过去的某个时候改变了他们的标准。
如果你没有成功,你可以尝试使用 where-object 向右过滤...即:
Get-MailboxStatistics | ?{$_.DisconnectDate -ne $null}
如果可行,显然使用前者。
我想说解决您的问题的最佳方法是如前所述通过 where-object 进行过滤。
以下内容应该适合您,尚未经过测试但应该是正确的。
Get-Mailbox -Filter 'ExtensionCustomAttribute1 -eq $null' | Get-MailboxStatistics | where {$_.DisconnectDate -eq $null -and $_.LastLogonTime -gt (Get-Date).AddDays(-90)}