Skip to content

Instantly share code, notes, and snippets.

@SSWConsulting
Created November 3, 2014 06:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SSWConsulting/74f9152794e9cc22e62d to your computer and use it in GitHub Desktop.
Save SSWConsulting/74f9152794e9cc22e62d to your computer and use it in GitHub Desktop.
Exchange
'This code gets the exchange server's computer name.
'
'References needed: MAPI
'
' 16/04/2002 John Liu
Private Function ExchangeName() As String
Dim s As New MAPI.Session()
s.Logon(, , , False, False)
' Get current user address entry ID
Dim strUserID As String = s.CurrentUser.ID
' Get the home server name out of the home MTA property
Dim strhomeserver As String
strhomeserver = s.GetAddressEntry(strUserID).Fields(PR_EMS_AB_HOME_MTA).value
' Get the actual name of the Exchange Server
strhomeserver = Mid(strhomeserver, InStr(1, strhomeserver, "/cn=Configuration/cn=Servers/cn=") + _
Len("/cn=Configuration/cn=Servers/cn="), 255)
strhomeserver = Left(strhomeserver, InStr(1, strhomeserver, "/") - 1)
s.Logoff()
Return strhomeserver
End Function
rem '----------------------------------------------
rem ' Copyright 2004 Superior Software for Windows
rem ' www.ssw.com.au All Rights Reserved.
rem
rem ' VERSION AUTHOR DATE COMMENT
rem '1.0 DH 12/7/2004 Written by DH
rem '----------------------------------------------
rem
rem Stop the Exchange Information Store Services
net stop "Microsoft Exchange Information Store"
rem Run a integrity check on the Private Information Store.
H:\Program Files\Exchsrvr\bin\eseutil /g "h:\Program Files\exchsrvr\MDBDATA\priv1.edb"
rem Run a integrity check on the Public Information Store.
H:\Program Files\Exchsrvr\bin\eseutil /g "h:\Program Files\exchsrvr\MDBDATA\pub1.edb"
rem Start the Exchange Information Store Services
net start "Microsoft Exchange Information Store"
pause
rem This compact utility works for Exchange 2000.
rem XADM: How to Defragment with the Eseutil Utility (Eseutil.exe)
rem more info http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q192185&
rem '----------------------------------------------
rem ' Copyright 2002 Superior Software for Windows
rem ' www.ssw.com.au All Rights Reserved.
rem
rem ' VERSION AUTHOR DATE COMMENT
rem '1.0 AC 5/8/2002 Written by AC, DDK and Tom Howe
rem '----------------------------------------------
rem /p and path is faster
rem Stop the Exchange Information Store Services
net stop "Microsoft Exchange Information Store"
rem Look at file sizes before
dir "C:\Program Files\Exchsrvr\MDBDATA\*.edb"
rem Compact and Repair the Private Information Store.
rem "c:\Program Files\exchsrvr\bin\eseutil.exe" /d "c:\Program Files\exchsrvr\mdbdata\priv1.edb"
"C:\Program Files\Exchsrvr\bin\eseutil.exe" /d "C:\Program Files\Exchsrvr\MDBDATA\priv1.edb"
rem Compact and Repair the Public Information Store.
rem "c:\Program Files\exchsrvr\bin\eseutil.exe" /d "C:\Program Files\Exchsrvr\MDBDATA\pub1.edb"
"C:\Program Files\Exchsrvr\bin\eseutil.exe" /d "C:\Program Files\Exchsrvr\MDBDATA\pub1.edb"
rem Look at file sizes after
dir "C:\Program Files\Exchsrvr\MDBDATA\*.edb"
rem Start the Exchange Information Store Services
net start "Microsoft Exchange Information Store"
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment