2012-03-20 59 views
2

我試圖在我們的Departed OU中顯示我們所有用戶的所有郵箱及其大小。我似乎非常接近,但我的命令似乎正在爲結果添加一些填充。交換 - 在郵箱大小的OU中列出郵箱

[PS] C:\Windows\system32>dsquery user "ou=Departed,ou=Staff,dc=COMPANY,dc=local" -limit 4 | dsget user -samid | Get-MailboxStatistics | ft DisplayName, TotalItemSize, ItemCount 

和輸出:

Dsquery has reached the specified limit on number of results to display; use a different value for the -limit option to 
display more results.The specified mailbox " samid     " doesn't exist. 
    + CategoryInfo   : NotSpecified: (0:Int32) [Get-MailboxStatistics], ManagementObjectNotFoundException 
    + FullyQualifiedErrorId : DD7D7CEA,Microsoft.Exchange.Management.MapiTasks.GetMailboxStatistics 

The specified mailbox " Eka.Tian    " doesn't exist. 
    + CategoryInfo   : NotSpecified: (1:Int32) [Get-MailboxStatistics], ManagementObjectNotFoundException 
    + FullyQualifiedErrorId : 7F701DFD,Microsoft.Exchange.Management.MapiTasks.GetMailboxStatistics 

顯然不應該工作的第一個結果 「SAMID」,而是 「Eka.Tian」 的存在。爲什麼要添加所有這些空間?有沒有一種方法可以格式化來自dsget用戶的輸出,所以它與Get-MailboxStatistics很好?

回答

9

爲什麼dsquery?

get-mailbox -OrganizationalUnit "ou=Departed,ou=Staff,dc=COMPANY,dc=local" -resultsize unlimited | 
get-mailboxstatistics | ft DisplayName,TotalItemSize,Itemcount 
+0

哦我的:) 我沒有看到-organizationunit開關。謝謝! – 2012-03-21 02:27:16