0

I wrote this small script to pull the office property from get-user by piping the exchange mailbox object.

$server = "tms08"
$arrUser = get-mailbox -Server $server |Get-MailboxStatistics |select identity
foreach ( $id in $arrUuser)
{
    $office = get-user -Identity $id.Identity |select office
    $out += $id.Identity 
}
$out 

I don't get any output or red errors. just the warning:

WARNING:There is no data to return for the specifed mailbox 'Globe/MobileElect Usertemplate', because it has not been logged on to. WARNING:By default only the first 1000 items are returned. To change the number of items returned, specify the parameter "-ResultSize". To return all items specify "-ResultSize Unilimited" (Note: REturning all items maytake a long time and consume a large amount of memory depending on the actual number of items). It is not recommended to store the results in a variable; instead pipe the results to another task or script to perform batch changes.

Any ideas on what might be causing this?

My goal is to develop a script which executes once a day via scheduled task which compiles all mailbox names, mailbox sizes, totalitems, totaldeleted items, along with their office and description fields (from active directory).

I'm guessing the get-qaduser is part of the quest powershell addon. I'll install it locally and give it a try..

the identiy property seems to give a number similar to the guid which looks like 1234as01-4f54-1234-b1df-f1df1df12d2d

I tried running

get-user -identity 1234as01-4f54-1234-b1df-f1df1df12d2d  

and it found a name (joey blasio) and recipient type (usermailbox)

then i ran

get-user -Identity 1234as01-4f54-1234-b1df-f1df1df12d2d | select displayname, distinguistedname  

Displayname (Joey Blasio ) and DistinguishedName (CN=Joey Blasio,OU=EWE,DC=BLA-1,DC=net)

4

2 回答 2

0

我认为问题在于您正在访问一个从未正常访问过的邮箱。您可以使用您知道所有者已打开并使用过的邮箱尝试此操作吗?还是已经是这样了?

另外,由于我目前无法访问我的 Exchange 机器,您能否告诉我 Identity 属性包含的内容?我绝对肯定在 Exchange 中使用类似Get-QADUservs.的 cmdletGet-User最终会给您带来更多的满足感。我们只需要将正确的属性与可以消费Get-MailboxStatistics的东西进行网格化Get-QADUser,这样它就可以为您提供正确的用户。

了解你的最终目标可能也有点帮助——可能有一种完全不同的方法可以让你到达你想去的地方。

于 2008-12-02T22:28:53.340 回答
0

它是由DisplayName

$exchangeservers = Get-MailboxServer
$AllUsers = @()
$AllUsersEmail = @()

foreach ($server in $exchangeservers)
{
    $AllUsers += Get-Mailbox -Server $server |Get-MailboxStatistics |select servername,displayname,itemcount,totalitemsize
}

foreach ($user in $AllUsers)
{
    $obj = new-object psObject
    $mailinfo = get-mailbox -identity $user.displayname |select PrimarySMTPAddress,Office, DistinguishedName
    $tmp = [adsi]("LDAP://" +  $mailinfo.DistinguishedName)


    $obj |Add-Member -MemberType noteproperty -Name "Server Name" -Value $user.ServerName
    $obj |Add-Member -MemberType noteproperty -Name "Display Name" -Value $user.DisplayName
    $obj |Add-Member -MemberType noteproperty -Name "Item Count" -Value $user.ItemCount
    $obj |Add-Member -MemberType noteproperty -Name "Total Item Size" -Value $user.TotalItemSize
    $obj |Add-Member -MemberType noteproperty -Name "Email Address" -Value $mailinfo.PrimarySMTPAddress
    $obj |Add-Member -MemberType noteproperty -Name "Office" -Value $mailinfo.Office
    $obj |Add-Member -MemberType noteproperty -Name "Description" -Value $tmp.description

    $AllUsersEmail += $obj
}

$AllUsersEmail |Export-Csv c:\test.csv -NoTypeInformation 
于 2008-12-03T00:25:59.827 回答