[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Vbscript: List Exchange user Mailboxs in a cluster

Posted on 2009-07-15
4
Medium Priority
?
603 Views
Last Modified: 2012-08-13
I need a Vbscript which can list the mailbox information in a cluster environment. I need the following information saved to .csv file.

ServerName ,StorageGroupName,StoreName ,OU path, MailboxDisplayName,Size,TotalItems, LastLogonTime, LastLogoffTime.

Thank You
0
Comment
Question by:raju1706
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
ou_dober earned 2000 total points
ID: 24861234
raju1706,

Here is a link to a script that does just that.

http://briandesmond.com/blog/script-to-dump-exchange-mailbox-info-to-spreadsheet-csv/

I added the code for quickness.  Hope this helps.

ou_dober

'==========================================================================
Option Explicit
 
' Note this script currently uses On Error Resume Next
' this isn't best practice - in reality this should be tightly 
' wrapped around the WMI connection logic in the loop rather
' than up here.
On Error Resume Next
 
' TODO: Configure this
' This is the total number of servers which you
' will specify for inventory
Const TOTAL_SERVERS = 3
 
Dim strComputer()
ReDim strComputer(TOTAL_SERVERS)
 
' TODO: Populate this array
' Enter each server name below as an entry in the array
' starting with zero
strComputer(0) = "xmb01"
strComputer(1) = "xmb02"
strComputer(2) = "xmb03"
 
'==========================================================================
 
Dim objWMIService
Dim colItems
 
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
 
Dim fil
Set fil = fso.CreateTextFile("mailboxes.txt")
 
Dim objItem
Dim line
Dim i
 
' Write a header row to the CSV
fil.WriteLine """Server"",""Storage Group"",""Mail Store"",""Mailbox GUID"",""Display Name"",""LegacyDN"",""Size"",""Item Count"",""Associated Content Count"",""Deleted Message Size"",""Date Absent"",""Storage Limit Level"""
 
For i = 0 To TOTAL_SERVERS - 1
	Set objWMIService = GetObject("winmgmts:" _
	    & "{impersonationLevel=impersonate}!\\" & strComputer(i) & _
	        "\ROOT\MicrosoftExchangeV2")
	
	Set colItems = objWMIService.ExecQuery _
	    ("Select * from Exchange_Mailbox")
	
	For Each objItem in colItems
		line = """" & objItem.ServerName & """"
		line = line & ","
		line = line & """" & objItem.StorageGroupName & """"
		line = line & ","
		line = line & """" & objItem.StoreName & """"
		line = line & ","
		line = line & """" & objItem.MailboxGUID & """"
		line = line & ","
		line = line & """" & objItem.MailboxDisplayName & """"    
		line = line & ","
		line = line & """" & objItem.LegacyDN & """"
		line = line & ","
		line = line & """" & objItem.Size & """"
		line = line & ","
		line = line & """" & objItem.TotalItems & """"
		line = line & ","
	    line = line & """" & objItem.AssocContentCount & """"
	    line = line & ","
	    line = line & """" & objItem.DeletedMessageSizeExtended & """"
	    line = line & ","
	    line = line & """" & objItem.DateDiscoveredAbsentInDS & """"
	    line = line & ","
	    line = line & """" & objItem.StorageLimitInfo & """"
	    
	    fil.WriteLine line 
	    'WScript.Echo line 
	Next
Next
 
fil.Close
Set fso = Nothing
Set objWMIService = Nothing

Open in new window

0
 
LVL 1

Author Comment

by:raju1706
ID: 24862172
Thank You ou.  Can you also help me with the full OU path of the mailbox ?
0
 
LVL 6

Expert Comment

by:ou_dober
ID: 24863263
I dont believe you need one with the objWMIServer is calling out the "\ROOT\MicrosoftExchangeV2".  Where do you see the need for the OU full path declaration?
0
 
LVL 1

Author Closing Comment

by:raju1706
ID: 31603707
Thank You ou_dober appreciate it.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently I finished a vbscript that I thought I'd share.  It uses a text file with a list of server names to loop through and get various status reports, then writes them all into an Excel file.  Originally it was put together for our Altiris server…
When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question