Get Department in EMC 2010 SP1
Hello I need information about users in specific database, and only First Name, Last Name, E-mail, Department using EMC. This One works well, but I cannot get Department, why ? : Get-Mailbox -ResultSize unlimited -Database "DB1" | Select-Object DisplayName,PrimarySmtpAddress,Department How to get department info ?
May 30th, 2012 3:42am

Hi Department is not a property of the mailbox so it is not returned by Get-Mailbox. You need to run Get-User for this instead. Try this: Get-Mailbox -ResultSize unlimited -Database "DB1" | Select-Object DisplayName,PrimarySmtpAddress,@{expression={(Get-User $_.name).Department}} Cheers, Steve
Free Windows Admin Tool Kit Click here and download it now
May 30th, 2012 5:07am

This one is not working. EMC retunrs : DisplayName PrimarySmtpAddress (Get-User $_.name).Department ----------- ------------------ -----------------------------
May 30th, 2012 7:55am

It should return the correct values, just the label needs to be set. Try this: Get-Mailbox -ResultSize unlimited -Database "DB1" | Select-Object DisplayName,PrimarySmtpAddress,@{label="Department";expression={(Get-User $_.name).Department}}
Free Windows Admin Tool Kit Click here and download it now
May 30th, 2012 8:41am

Works fine for me, the only thing I would do is tidy it up with a corrected label: get-mailbox -ResultSize Unlimited -database "DB1" | Select-Object DisplayName,PrimarySmtpAddress,@{label="Department";expression={(Get-user $_.name).Department}} Are you sure your department fields are populated? Also, if you could paste the command you are using that yields a blank result.
May 30th, 2012 8:51am

I've just tried this on another system and sometimes it starts completing the department column about half way through the results. The lines before that are blank and I don't know what would cause this.
Free Windows Admin Tool Kit Click here and download it now
May 30th, 2012 9:53am

I just saw the same thing, the pipeline does not seem to execute the expression command for a while.... well, the only workaround I can think of is to use the trusty dusty foreach method, it takes a while to run, but it works: $Mailboxes=Get-Mailbox -ResultSize Unlimited -Database "DB1" $report=@() foreach ($mailbox in $mailboxes) { $ReturnedObj=New-Object PSObject $ReturnedObj | Add-Member NoteProperty -Name "Display Name" -Value $Mailbox.DisplayName $ReturnedObj | Add-Member NoteProperty -Name "Primary Email" -Value $Mailbox.PrimarySmtpAddress $ReturnedObj | Add-Member NoteProperty -Name "Department" -Value $(Get-User $mailbox.name).Department $Report+=$ReturnedObj } $Report #Uncomment below to export to CSV #$Report | Export-CSV ".\FileName.CSV" -NoTypeInformation
May 30th, 2012 10:16am

Nice Steve, I will remember that one.
Free Windows Admin Tool Kit Click here and download it now
May 30th, 2012 11:25am

Hi Krieghoff Did you try those Command above? They works fine on my Exhange. If it works, Please Mark Steve's post As Answer and finish this thread CheersZi Feng TechNet Community Support
May 30th, 2012 10:56pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics