Extract all possible information from a particular Store in exchange 2007.

bsharath
bsharath used Ask the Experts™
on
Hi,

Extract all possible information from a particular Store in exchange 2007.
Maintly
Username

regards
Sharath
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Chris DentPowerShell Developer
Top Expert 2010

Commented:

You could use either Get-Mailbox or Get-MailboxStatistics (or join up both). Is that the kind of information you're after? That is, information on the users inside the store rather than the store itself?

Chris

Author

Commented:
My purpose is to get just the users name in which Storage the are
Chris DentPowerShell Developer
Top Expert 2010

Commented:

Just this?

Get-Mailbox | Select-Object Name, Database

Chris
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Author

Commented:
Should i mention the database name or will i get from all database
I want to extract for a specific Storage
and how should the format be
Chris DentPowerShell Developer
Top Expert 2010

Commented:

If you want a specific store you can use the Database parameter:


Get-Mailbox -Database "StoreName" | Select-Object Name, Database | Export-Csv "SomeFile.csv"


Is that what you're after?

Chris

Author

Commented:
Should i change this
"StoreName"
as
"First Storage Group\IN-STORE1-4"
Chris DentPowerShell Developer
Top Expert 2010

Commented:

Ah yes, it's a database identifier and your proposed change looks good.

Chris

Author

Commented:
I get this

Get-Mailbox : Database "First Storage Group\IN-STORE1-4" was not found. Please m
Chris DentPowerShell Developer
Top Expert 2010

Commented:

Hmm can you run:

Get-MailboxDatabase

See if the store is listed there? You may need to specify the server name, and if that's the case piping from Get-MailboxDatabase may be better. e.g.

Get-MailboxDatabase "IN-STORE1-4" | Get-Mailbox

Chris

Author

Commented:
When i see a users properties the datasabse shows as
First Storage Group\IN-STORE1-4
But with this command i cannot see that store.
Get-MailboxDatabase
Chris DentPowerShell Developer
Top Expert 2010

Commented:

How does it appear in the Management Console?

Chris

Author

Commented:
EMC it appears as
First Storage Group\IN-STORE1-4
Chris DentPowerShell Developer
Top Expert 2010

Commented:

On the same server I assume?

It's not returned at all by Get-MailboxDatabase? Run:

Get-MailboxDatabase | Format-List *

That'll show you everything which may make it easier to spot.

Chris

Author

Commented:
Ya here i can see it

Server                        : IN-MSG03
ServerName                    : IN-MSG03
StorageGroup                  : IN-MSG03\First Storage Group
Name                          : IN-STORE1-4
AdminDisplayName              : IN-STORE1-4
Chris DentPowerShell Developer
Top Expert 2010

Commented:

Try...


Get-Mailbox -Database "IN-MSG03\First Storage Group\IN-STORE1-4" | Select-Object Name, Database | Export-Csv "SomeFile.csv"


Chris

Author

Commented:
i get this

[PS] D:\>Get-Mailbox -Database "IN-MSG03\First Storage Group\IN-STORE1-4" | Select-Object Name, Database | Export-Csv "SomeFile1.csv"
Get-Mailbox : Database "IN-MSG03\First Storage Group\IN-STORE1-4" was not found. Please make sure you have typed it correctly.
At line:1 char:12
+ Get-Mailbox <<<<  -Database "IN-MSG03\First Storage Group\IN-STORE1-4" | Select-Object Name, Database | Export-Csv "SomeFile1.csv"
    + CategoryInfo          : NotSpecified: (0:Int32) [Get-Mailbox], ManagementObjectNotFoundException
    + FullyQualifiedErrorId : B4EF032E,Mi
Chris DentPowerShell Developer
Top Expert 2010

Commented:

That's not too helpful...

Try this one?

Get-MailboxDatabase | ?{ $_.Name -eq "IN-STORE1-4" } | Get-Mailbox

Chris

Author

Commented:
Its actuall perfect
I get this
By default only the first 1000 items are

Author

Commented:
For the other post to move mailboxes i need to place samaccount. Can i get the samaccount also with the display name
Chris DentPowerShell Developer
Top Expert 2010

Commented:

Should be okay, lets see...


Get-MailboxDatabase |
  ?{ $_.Name -eq "IN-STORE1-4" } |
  Get-Mailbox -ResultSize Unlimited |
  Select-Object SamAccountName, DisplayName |
  Export-Csv "SomeFile.csv" -NoTypeInformation


Chris
PowerShell Developer
Top Expert 2010
Commented:

And to work with this the other script will change to:


Import-Csv "SomeFile.csv" | ForEach-Object {
  Move-Mailbox $_.SamAccountName -TargetDatabase "server\storagegroup\store" -BadItemLimit 100
} | Export-Csv "LogFile.csv"


Chris

Author

Commented:
With this i get nothing as output

Get-MailboxDatabase |
  ?{ $_.Name -eq "IN-STORE1-4" } |
  Get-Mailbox -ResultSize Unlimited |
  Select-Object SamAccountName, DisplayName |
  Export-Csv "SomeFile.csv" -NoTypeInformation


This line has worked
Get-Mailbox -Database "IN-MSG03\First Storage Group\IN-STORE1-4" | Select-Object Name, Database | Export-Csv "SomeFile.csv"
Just the limit needs to be exeeded that 1000
Chris DentPowerShell Developer
Top Expert 2010

Commented:

Then it needs:


Get-Mailbox -Database "IN-MSG03\First Storage Group\IN-STORE1-4" -ResultSize Unlimited | Select-Object Name, Database, SamAccountName, DisplayName | Export-Csv "SomeFile.csv"


Added the other two fields as well, if it runs the output will still work with the modified Move-Mailbox script above.

Chris

Author

Commented:
Thanks a lot Chris... :-)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial