Solved

VB Script for running Exchange Integrity Checks

Posted on 2010-08-19
18
569 Views
Last Modified: 2012-05-10
I am looking to create a VB Script or Batch file that will dismount my exchange stores, run eseutil and defrag them, then run an integrity check w/ the P parameter, then run ISINTEG with the fix parameter, then remount the stores. I am hoping to have them not name specific so I can run them on a few different domains.
0
Comment
Question by:agentkolb
[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
  • 7
  • 6
  • 2
  • +1
18 Comments
 
LVL 31

Expert Comment

by:MegaNuk3
ID: 33479231
/P is not integrity check it is hard repair, which you should never run unless your database is failing to mount or is corrupt

/G is integrity
0
 

Author Comment

by:agentkolb
ID: 33479246
MegaNuk3,

You are correct. I meant /G Thanks!
0
 
LVL 31

Expert Comment

by:MegaNuk3
ID: 33479261
A simple batch file would be:
net stop msexchangeis
eseutil /g <EDB name> >>c:\eseutil.log
isinteg -s servername -fix -test alltests  >>isinteg.log
net start msexchangeis

as long as the databases are set to mount on startup then the databases should mount.
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 31

Expert Comment

by:MegaNuk3
ID: 33479280
oops I forgot the eseutil /d in there... best to run that before the isinteg.

I don't think there is any point in running the /g as the /d is going to create a new database anyway.
0
 
LVL 12

Expert Comment

by:Rant32
ID: 33479682
I guess GP is looking for a way to find those EDB names automatically. It's in AD somewhere :)
I have a huge pile of Exchange/AD VB scripting at work, but it'll have to wait a little.

Also, I would like to unroot the belief that defragmenting with eseutil is inherently Good.
Defragmenting the database files is really only recommended if you expect to gain a lot of free disk space from it, or if you absolutely want to shrink the files.

It's better to have the files physically contiguous (using disk defragmenter or the likes) and leave the database files with enough free space to prevent growth and new fragmentation. The files will probably grow again to the same size anyway, unless your database usage has changed.

Just to be verbose, information from performance counters is very useful: for example, how much free space is available in the database and the total size. If you gain 600 MB on a 11 GB database, or less than 20% for example, I'd skip the defrag. This also allows you to estimate the amount of time required for all of this.
0
 
LVL 31

Expert Comment

by:MegaNuk3
ID: 33479743
Have a look for the 1221 event, if you are not going to gain large amounts of whitespace back then it is not worth doing the defrag.

It is normally easier and quicker to move all the mailboxes to a new DB.
0
 
LVL 12

Expert Comment

by:Rant32
ID: 33480267
But moving mailboxes will lose single instance storage on previous Exchange versions, and may not solve physical fragmentation.
Depending on the SIS ratio, your database could grow mildly (which is the opposite effect of defragmenting) or it could blow up (which is not good if you're already pushing the size limits of Standard Edition).

Sorry, I don't agree. It may be faster, but it doesn't accomplish much in terms of reducing size.
0
 
LVL 31

Expert Comment

by:MegaNuk3
ID: 33485233
When you move mailboxes they lose their items in deleted item retention so you will get a lot of space back that way.

There are advantages to both methods. Moving mailboxes does not require hours of downtime for the DB and all the mailboxes on it though
0
 
LVL 12

Expert Comment

by:Rant32
ID: 33485939
Nuke, now you've actually lost me. Why would you configure deleted item retention, only to throw it away during maintenance?

Saving space on deleted items is useless, because it's a sliding window. The space gain is bogus after 30 days, or whatever the deleted item retention time is, and you're left with all duplicated items.

ESE will perform best without tricks like these. If it's not worth the downtime, then it's not worth the maintenance.
0
 
LVL 31

Expert Comment

by:MegaNuk3
ID: 33488339
deleted item retention is good if you have users who accidentally delete things and want it back a couple days later then you can just undelete it....

If you are trying to shrink the database as much of possible then getting rid of all the deleted item retention is good...
0
 
LVL 12

Expert Comment

by:Rant32
ID: 33522007
I'm almost finished with the script that I promised. I just need to add a disk space check and to test portability, I need to run it against another Exchange test server I have.

Just a little while...
0
 
LVL 12

Accepted Solution

by:
Rant32 earned 500 total points
ID: 33526459
Alright, here it is. A few things:

- It doesn't run isinteg -fix. First of all, it's a pain to make it unattended, second, they did make it so deliberately. Fixing databases is not a routine job.
- The integrity check runs first. If that succeeds, the store is defragmented.
- There is a line "DoNothing = True". You must change it to "DoNothing = False" to actually perform the intrusive tasks like dismounting the store.
- To defrag, you need at least the amount of free space equal to the database size (edb+stm). The TEMPDEFRAG files end up in the working directory where you run the script from, so that space counts (e.g. don't run it from CD :)
- Databases that are not mounted to begin with will not be mounted again.
- Output is logged to console, so if you want a log file then redirect > to file.

Otherwise, all paths and databases are collected so it should run against any Exchange 2003 server regardless of Storage Groups and the amount of stores.

Check the output first with DoNothing=True to see if it does what you expect.
ExchangeStores.vbs
0
 
LVL 12

Expert Comment

by:Rant32
ID: 33526518
Oh, I forgot to mention: because of the way ESEUTIL writes its output to StdOut (console), you may not see any progress or output while the Integrity/Defrag command is running. You will have the output when it's finished. So no progress, sorry.
0
 

Author Comment

by:agentkolb
ID: 33576922
Hey Rant, thanks so much for the script. Give me a few to test to ensure it does like I asked and I appreciate all the hard work!
0
 
LVL 12

Expert Comment

by:Rant32
ID: 34075993
This is not an objection, but I'd still like to know how it went...
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 34109766
This question has been classified as abandoned and is being closed as part of the Cleanup Program.  See my comment at the end of the question for more details.
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

How to resolve IMCEAEX NDRs in Exchange or Exchange Online related to invalid X500 addresses.
A list of top three free exchange EDB viewers that helps the user to extract a mailbox from an unmounted .edb file and get a clear preview of all emails & other items with just a single click on mailboxes.
In this video we show how to create a Distribution Group in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >>…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

733 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