Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Exchange Mailbox using vbscript

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,2104
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Exchange Mailbox using vbscript
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Exchange Mailbox using vbscript - 2/18/2005 1:48:31 AM   
  mrpickford

 

Posts: 5
Score: 0
Joined: 2/18/2005
From: United Kingdom
Status: offline
Hello,

Could anybody please help me, i am trying to get exchnage mailbox names and sizes out of exchnage using vbscript,

could anybody please advise as i am a network engineer and not entirely up-to-speed on programming.

cheers

craig
 
 
Post #: 1
 
 Re: Exchange Mailbox using vbscript - 2/18/2005 2:14:01 AM   
  tnoonan

 

Posts: 364
Score: 0
Joined: 12/14/2004
From:
Status: offline
http://outlookexchange.com/articles/glenscales/mreport1.asp

(in reply to mrpickford)
 
 
Post #: 2
 
 Re: Exchange Mailbox using vbscript - 2/18/2005 2:24:59 AM   
  mrpickford

 

Posts: 5
Score: 0
Joined: 2/18/2005
From: United Kingdom
Status: offline
hi, thanks for your quick responce, i have had a look through the article but it seems a bit confusing to me,

ideally i would just like to manually run the script and it display it on screen (ie echo/msgbox) like the examples on microsoft. From here i can add it into the mail that i plan on sending.

any further advise on this would be greatly appreciated.

thanks again

craig

(in reply to mrpickford)
 
 
Post #: 3
 
 Re: Exchange Mailbox using vbscript - 2/18/2005 2:49:23 AM   
  tnoonan

 

Posts: 364
Score: 0
Joined: 12/14/2004
From:
Status: offline
Option Explicit

' ------------------------------------------------------------------------
Function EnumMailboxStore (urlMailboxStoreDB)


' --------------------------------------------------------------------
WScript.Echo Space (intX + 1) & _
"Retrieving User/mailbox list via 'ADSI/ADO' LDAP Query."

' Search Active Directory for the list of user mailboxes.
Set objResultList = ADSearch ("LDAP://" & strDefaultDomainNC, _
"(homeMDB=" & urlMailboxStoreDB & ")", _
"ADsPath", _
"subTree", _
False)

' --------------------------------------------------------------------
objResult = objResultList.Items


For intIndice = 1 to (objResultList.Count - 1)

Set objUser = GetObject (objResult (intIndice))
objUser.GetInfo

' Getting two properties for display facilities.
strAlias = objUser.Get ("mailNickName")
strDisplayName = objUser.Get ("displayName")


strTemp = "" : strTemp = objUser.AccountDisabled
DisplayText "AccountDisabled(ADSI)", strTemp
strTemp = "" : strTemp = objUser.AccountExpirationDate
DisplayText "AccountExpirationDate(ADSI)", strTemp
' objUser.BadLoginAddress
strTemp = "" : strTemp = "(Not supported in LDAP namespace)"
DisplayText "BadLoginAddress(ADSI)", strTemp
strTemp = "" : strTemp = objUser.BadLoginCount
DisplayText "BadLoginCount(ADSI)", strTemp
strTemp = "" : strTemp = objUser.Department
DisplayText "Department(ADSI)", strTemp


DisplayText "FirstName(ADSI)", strTemp
strTemp = "" : strTemp = objUser.FullName
DisplayText "FullName(ADSI)", strTemp
' objUser.GraceLoginsAllowed
strTemp = "" : strTemp = "(Not supported in LDAP namespace)"
DisplayText "GraceLoginsAllowed(ADSI)", strTemp
' objUser.GraceLoginsRemaining
strTemp = "" : strTemp = "(Not supported in LDAP namespace)"
DisplayText "GraceLoginsRemaining(ADSI)", strTemp
strTemp = "" : strTemp = objUser.HomeDirectory
DisplayText "HomeDirectory(ADSI)", strTemp
strTemp = "" : strTemp = objUser.HomePage
DisplayText "HomePage(ADSI)", strTemp
' objUser.IsAccountLocked
strTemp = "" : strTemp = "(Not supported in LDAP namespace)"
DisplayText "IsAccountLocked(ADSI)", strTemp
strTemp = "" : strTemp = objUser.Languages
DisplayText "Languages(ADSI)", strTemp


strTemp = "" : strTemp = objUser.LoginScript
DisplayText "LoginScript(ADSI)", strTemp
strTemp = "" : strTemp = objUser.LoginWorkstations
DisplayText "LoginWorkstations(ADSI)", strTemp
strTemp = "" : strTemp = objUser.Manager
DisplayText "Manager(ADSI)", strTemp
' objUser.MaxLogins
strTemp = "" : strTemp = "(Not supported in LDAP namespace)"
DisplayText "MaxLogins(ADSI)", strTemp


strTemp = "" : strTemp = objUser.OtherName
DisplayText "OtherName(ADSI)", strTemp
' objUser.PasswordExpirationDate
strTemp = "" : strTemp = "(Not supported in LDAP namespace)"
DisplayText "PasswordExpirationDate(ADSI)", strTemp
strTemp = "" : strTemp = objUser.PasswordLastChanged
DisplayText "PasswordLastChanged(ADSI)", strTemp
' objUser.PasswordMinimumLength
strTemp = "" : strTemp = "(Not supported in LDAP namespace)"
DisplayText "PasswordMinimumLength(ADSI)", strTemp
strTemp = "" : strTemp = objUser.PasswordRequired


strTemp = "" : strTemp = objUser.Profile
DisplayText "Profile(ADSI)", strTemp
' objUser.RequireUniquePassword
strTemp = "" : strTemp = "(Not supported in LDAP namespace)"
DisplayText "RequireUniquePassword(ADSI)", strTemp
strTemp = "" : strTemp = objUser.SeeAlso
DisplayText "SeeAlso(ADSI)", strTemp
strTemp = "" : strTemp = objUser.TelephoneHome


strTemp = "" : strTemp = objUser.TelephonePager
DisplayText "TelephonePager(ADSI)", strTemp
strTemp = "" : strTemp = objUser.Title
DisplayText "Title(ADSI)", strTemp

' At this level of the object hierarchy, you can determine
' the group membership, and set and change the password
' of a user object.
' objUser.Groups
' objUser.SetPassword
' objUser.ChangePassword


DisplayText "Data retrieved via 'IMailboxStore CDOEXM' interface", ""

DisplayText "DaysBeforeGarbageCollection(CDOEXM)", _
objUser.DaysBeforeGarbageCollection
DisplayText "EnableStoreDefaults(CDOEXM)", _
objUser.EnableStoreDefaults
DisplayText "GarbageCollectOnlyAfterBackup(CDOEXM)", _
objUser.GarbageCollectOnlyAfterBackup
DisplayText "Hardlimit(CDOEXM)", objUser.Hardlimit
DisplayText "HomeMDB(CDOEXM)", objUser.HomeMDB
DisplayText "OverQuotaLimit(CDOEXM)", objUser.OverQuotaLimit
DisplayText "OverrideStoreGarbageCollection(CDOEXM)", _
objUser.OverrideStoreGarbageCollection
DisplayText "RecipientLimit(CDOEXM)", objUser.RecipientLimit
DisplayText "StoreQuota(CDOEXM)", objUser.StoreQuota

For Each strDelegate In objUser.Delegates
DisplayText "Delegate(CDOEXM)", strDelegate
Next

' At this level of the object hierarchy, you can create, move,
' or delete a mailbox from the mailbox store.
' objUser.CreateMailBox
' objUser.DeleteMailBox
' objUser.MoveMailBox

' End Function
' End

(in reply to mrpickford)
 
 
Post #: 4
 
 Re: Exchange Mailbox using vbscript - 2/18/2005 3:07:31 AM   
  mrpickford

 

Posts: 5
Score: 0
Joined: 2/18/2005
From: United Kingdom
Status: offline
thanks very much for that, however i have put it into a vbs file that is on my server and i seem to be getting a few errors,

im not sure where, but it seems to be at the bottom, am i using this code correctly??

i cant thank you enough for your help so far,

thanks

(in reply to mrpickford)
 
 
Post #: 5
 
 Re: Exchange Mailbox using vbscript - 2/18/2005 3:16:53 AM   
  tnoonan

 

Posts: 364
Score: 0
Joined: 12/14/2004
From:
Status: offline
Did it not tell you what line the error is on. Also You can find more scripts Here:

http://support.microsoft.com/?id=320071

(in reply to mrpickford)
 
 
Post #: 6
 
 Re: Exchange Mailbox using vbscript - 2/18/2005 3:20:13 AM   
  mrpickford

 

Posts: 5
Score: 0
Joined: 2/18/2005
From: United Kingdom
Status: offline
thanks again for your help,

the error seems to be at the bottom where the "end" and "end function" are.

also, im not sure but should this whole script just run off my server and display the mailbox information from the exchange/ad server?

thanks a lot again.

craig

(in reply to mrpickford)
 
 
Post #: 7
 
 Re: Exchange Mailbox using vbscript - 2/18/2005 3:34:11 AM   
  mrpickford

 

Posts: 5
Score: 0
Joined: 2/18/2005
From: United Kingdom
Status: offline
hi,

it falls over on line 12 char 2

Type Mismatch 'ADsearch'

any ideas??

(in reply to mrpickford)
 
 
Post #: 8
 
 Re: Exchange Mailbox using vbscript - 2/18/2005 8:16:55 AM   
  tnoonan

 

Posts: 364
Score: 0
Joined: 12/14/2004
From:
Status: offline
Im not getting that error.

(in reply to mrpickford)
 
 
Post #: 9
 
 Re: Exchange Mailbox using vbscript - 2/18/2005 9:53:01 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
hmm.. is ADSearch a built-in method of something ?

(in reply to mrpickford)
 
 
Post #: 10
 
 Re: Exchange Mailbox using vbscript - 2/18/2005 3:02:30 PM   
  tnoonan

 

Posts: 364
Score: 0
Joined: 12/14/2004
From:
Status: offline
Sorry here is the Reference link.

http://www.microsoft.com/technet/prodtechnol/exchange/2000/maintain/ex2kwsh.mspx

(in reply to mrpickford)
 
 
Post #: 11
 
 Re: Exchange Mailbox using vbscript - 2/18/2005 8:24:14 PM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
ah! Thanks :D

(in reply to mrpickford)
 
 
Post #: 12
 
 RE: Re: Exchange Mailbox using vbscript - 10/15/2007 8:53:46 PM   
  4scriptmoni


Posts: 200
Score: 0
Joined: 5/3/2007
Status: offline
Here it is my script for that, it also creates a report txt indicating how many users in each DB.
just make sure to create a folder log where the script is.

      


enjoy it.

_____________________________

Enterprise Microsoft Scripts
Exchange, Login/Logout Monitor,TS, Monitoring, Security, AD, etc...
http://www.felipeferreira.net

(in reply to token)
 
 
Post #: 13
 
 RE: Exchange Mailbox using vbscript - 10/17/2007 4:54:49 AM   
  paulv

 

Posts: 1
Score: 0
Joined: 10/17/2007
Status: offline
I run the below on the exchange server itself.
It dumps out a file called mailboxes.csv with all the info to C:\stuff

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objResultsFile = objFSO.CreateTextFile("C:\stuff\mailboxes.csv", True)

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\MicrosoftExchangeV2")
Set colItems = objWMIService.ExecQuery ("Select * from Exchange_Mailbox")

For Each objItem in colItems
objResultsFile.Write objItem.MailboxDisplayName & ","
objResultsFile.Write objItem.Size
objResultsFile.Writeline
Next

objResultsFile.Close

(in reply to mrpickford)
 
 
Post #: 14
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Exchange Mailbox using vbscript Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts