Powershell resultsize问题-找不到与参数名称';结果大小';

Powershell resultsize问题-找不到与参数名称';结果大小';,powershell,office365,pst,Powershell,Office365,Pst,我想获取上次登录超过180天的office365邮箱列表?并将其.pst文件导出到其他位置? 我写了这个剧本 但我收到的错误类似于-找不到与参数名称“resultsize”匹配的参数 找不到问题出在哪里 Get-MailboxStatistics -resultsize unlimited | Where-Object {$_.LastLogonTime -lt (get-date).AddDays(-180)} | Format-Table displayName,lastlogo

我想获取上次登录超过180天的office365邮箱列表?并将其.pst文件导出到其他位置? 我写了这个剧本

但我收到的错误类似于-找不到与参数名称“resultsize”匹配的参数 找不到问题出在哪里

Get-MailboxStatistics -resultsize unlimited |
  Where-Object {$_.LastLogonTime -lt (get-date).AddDays(-180)} |
    Format-Table displayName,lastlogontime,lastloggedonuseraccount,servername

Get-MailboxStatistics
没有
-ResultSize
参数。您应该使用
Get Mailbox
检索邮箱,并通过管道结果获取统计信息:

Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics

Get-MailboxStatistics
没有
-ResultSize
参数。您应该使用
Get Mailbox
检索邮箱,并通过管道结果获取统计信息:

Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics

嗨,欢迎!请格式化代码片段以提高可读性。此外,还要避免使用别名,而是使用全名。(
Format Table
vs.
ft
)我稍微编辑了一下帖子。嗨,欢迎光临!请格式化代码片段以提高可读性。此外,还要避免使用别名,而是使用全名。(
Format Table
vs.
ft
)我稍微编辑了一下帖子。谢谢,修改了脚本,它开始工作了。Get-mailbox-ResultSize Unlimited | Get-MailboxStatistics | where{$\ uuu.LastLogonTime-lt(Get-date).AddDays(-180)}ft-displayName、LastLogonTime、lastloggedonuseraccount、servername | Out文件C:\script\lastlogonMC.csvThanks、修改后的脚本开始工作。Get mailbox-ResultSize Unlimited | Get MailboxStatistics |其中{$\ LastLogonTime-lt(Get date).AddDays(-180)}| ft displayName,LastLogonTime,lastloggedonuseraccount,servername | Out文件C:\script\lastlogonMC.csv