Powershell - filter users by Database
Hi All,I am wanting something pretty simple, just a list of users on a particular database. I must be being a donkey as i can't see what i doing wrong. I am the first to admit i am new to powershell, but i was hoping i would be able to get something like this running ok on my own get-mailbox -filter {Database -eq "DG-MAIL\First Storage Group\Leavers"}i get an error running this. Can anyone point me in the right direction? its driving me nuts!CheersDave
August 5th, 2008 2:20pm

Hi Dave, Its better to use pipe to filter the result, instead of using filter switch. Use this one Get-Mailbox -ResultSize Unlimited | Where{$_.Database -eq "DG-MAIL\First Storage Group\Leavers"} This is for your advance reference to find other details for indivudial mailboxes like TotalItemSize, ItemCount, LastLogonTime, LastLogoffTime, LastLoggedOnUserAccount EMC - Where are Mailbox Total Items & Size (KB)Columns?
Free Windows Admin Tool Kit Click here and download it now
August 5th, 2008 2:53pm

Thanks for your reply amir - i will try it tonight. I'm sure it will work though!Is there a reason that i can't use the -filter swich or rather i shouldn't use the filter switch? all the examples i have seen seem to use this...ThanksDave
August 5th, 2008 4:06pm

Another easy way: Get-mailbox resultsize unlimited database DG-MAIL\First Storage Group\Leavers If you want to use filter: Get-mailbox -filter {Database -eq "CN=Mailbox Database,CN=First Storage Group,CN=InformationStore,CN=SGC,CN=Servers,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=SG,DC=com"} The orange part is that databases DistinguishedName, you can get it from the cmdlet below: Get-mailboxdatabase DG-MAIL\First Storage Group\Leavers | fl
Free Windows Admin Tool Kit Click here and download it now
August 7th, 2008 7:30am

Yep, the -database switch would be the simplest way to do this
August 7th, 2008 4:12pm

Hi, David. Did you triy Amit and my methods? Does it work?
Free Windows Admin Tool Kit Click here and download it now
August 8th, 2008 4:23am

Hi, David, I suppose your question has been answered, and I'd like to change the status to "Marked as answer", please feel free to post here if you have any update
August 11th, 2008 4:36am

yes thanks for all who replied - that is it sorted now.thanks for the help chaps.
Free Windows Admin Tool Kit Click here and download it now
August 11th, 2008 8:38pm

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

Other recent topics Other recent topics