Export Primary Mailbox Names and Primary SMTP Addresses from a Specific Storage Group
Hello, I am trying to export the Mailbox names and primary SMTP addresses from a specific storage group. Can someone help me out with this PS command? This is what I have so far but with no luck. [PS] C:\>Get-StorageGroup -Identity "Server Name\SG-F" | Get-Mailbox | Format-Table Alias,*SMTP* | Export-CSV emaillist.csv Jason
January 4th, 2011 4:53pm

C:\>Get-StorageGroup -Identity "Server Name\SG-F" | Get-Mailbox | select alias,primarysmtpaddress | Export-CSV emaillist.csv -notype[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Free Windows Admin Tool Kit Click here and download it now
January 4th, 2011 5:09pm

Thanks for this command.... Now I am receiving the following error message: Get-StorageGroup : The operation could not be performed because object 'SG-F' c ould not be found on domain controller 'COLADC01.lawfirm.local'. At line:1 char:17 + Get-StorageGroup <<<< -Identity "SG-F" | Get-Mailbox | select name,alias,pri marysmtpaddress | Export-Csv c:\emaillist.csv -notype + CategoryInfo : InvalidData: (:) [Get-StorageGroup], ManagementO bjectNotFoundException + FullyQualifiedErrorId : 739FAF37,Microsoft.Exchange.Management.SystemCon figurationTasks.GetStorageGroup Can you assist me with this hurdle?Jason
January 4th, 2011 5:21pm

try this: get-storagegroup |% {($_.identity).tostring()} then pick the SG you're after from that list and enter (or copy\paste)it just as it appears in that list.[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Free Windows Admin Tool Kit Click here and download it now
January 4th, 2011 5:27pm

Do you see anything wrong with this below? [PS] C:\>Get-StorageGroup |% {($_.identity).tostring()} COLAEXMBX01\SG-E-Pub COLAEXMBX01\SG-E COLAEXMBX01\SG-F COLAEXMBX01\SG-G COLAEXMBX01\SG-J COLAEXMBX01\SG-N COLAEXMBX01\SG-I COLAEXMBX01\SG-K COLAEXMBX01\SG-H COLAEXMBX01\SG-M DREXMBX01\DR-SG-E DREXMBX01\DR-SG-F DREXMBX01\DR-SG-G DREXMBX01\DR-SG-H DREXMBX01\DR-SG-I DREXMBX01\DR-SG-J DREXMBX01\DR-SG-K DREXMBX01\DR-SG-M DREXMBX01\DR-SG-N DREXMBX01\DR-SG-O COLAEXMBX01\Recovery Storage Group 1 DREXMBX01\First Storage Group COLAEXMBX01\SG-O [PS] C:\>Get-StorageGroup -Identity "COLAEXMBX01\SG-F" | Get-Mailbox | select na me,alias,primarysmtpaddress | Export-Csv c:\emaillist.csv -notype Get-Mailbox : The operation could not be performed because object 'COLAEXMBX01\ SG-F' could not be found on domain controller 'COLADC02.lawfirm.local'. At line:1 char:60 + Get-StorageGroup -Identity "COLAEXMBX01\SG-F" | Get-Mailbox <<<< | select na me,alias,primarysmtpaddress | Export-Csv c:\emaillist.csv -notype + CategoryInfo : InvalidData: (:) [Get-Mailbox], ManagementObject NotFoundException + FullyQualifiedErrorId : 17C19F99,Microsoft.Exchange.Management.Recipient Tasks.GetMailbox [PS] C:\>Jason
January 4th, 2011 5:31pm

I believe you need to get the database not the storage group. Assuming you only have 1 database per storage group this would be easy to just do a get-database rather than get-storage group. Otherwise you will have to do something like get-storagegroup ident | get-mailboxdatabase | get-mailbox blah blah.Chris Morgan
Free Windows Admin Tool Kit Click here and download it now
January 4th, 2011 5:45pm

OK, the problem is that you can't pipe get-storagegroup to get-mailbox. see if this works: get-mailbox -server COLAEXMBX01 | where {$_.database -like "*\SG-F\*"} | select alias,primarysmtpaddress | export-csv c:\emaillist.csv -notype In E2k7 the mailbox has a database property that's spec'd as server\storagegroup\database. -like "*\SG-F\*" should get all the maliboxes on any database in that SG.[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
January 4th, 2011 5:49pm

Hi Jason, Any update for your issue? Above gave some good suggestion. Regards! Gavin TechNet Subscriber Support in forum If you have any feedback on our support, please contact tngfb@microsoft.com Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
January 5th, 2011 4:40am

MJOLINOR and Chris, Thanks for the assistance on this PS command. The command MJOLINOR provided worked like a champ. Gavin-Zhang - Thanks for following up on this thread as well. Jason
January 5th, 2011 9:12am

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

Other recent topics Other recent topics