Friday, March 31, 2006

What to do when a database won't mount

I came across the following site today while troubleshooting a database in the Recovery Storage Group that wouldn't mount.
What to do when an Exchange Store won't mount

The odd thing is that removing the database from the RSG and then re-adding it allowed me to mount the database without a problem.


Tuesday, March 28, 2006

Exchange 2003 Tunning - Back End Servers

I'm creating a build doc for all the Exchange 2003 mailbox servers. The servers will each hold 4000 mailboxes, and have 4 GB of memory. Here's what I'll be manually tunning:

1. Optimize Memory Usage
Heap Manager
- Minimizes VM fragmentation by increasing the amount of free space required before the heap manager frees up memory (default is 0)
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager
Value Name: HeapDeCommitFreeBlockThreshold
Radix: Decimal
Value Type: REG_DWORD
Value Data: 262144 (0x00040000 in hex)

Virtual Address Space
- 3GB allocates 3 GB of virtual address space to user mode. The number after userva is the amount of memory in megabytes (MB) that will be allocated to each process.
Edit the Boot.ini File.
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Enterprise" /fastdetect /3gb /userva=3030

2. Align I/O with Storage Track Boundaries (All SAN attached drives)
- Prevent a possible 20% performance hit due to track skipping
C:\>Diskpar –s drivenumber
Respond to both warnings by typing y
Please specify starting offset (in sectors): 128
Please specify partition length: [Pressing Enter will default to the max length]

3. Optimize NTBAckup
- optimize the data throughput.
HKEY_CURRENT_USER\Software\Microsoft\Ntbackup\BackupEngineIf BackupEngine is missing, run ntbackup once.
Logical Disk Buffer Size = 64
Max Buffer Size = 1024
Max Num Tape Buffers = 16

4. Improve Refresh time of mailbox configuration
- Mailbox limits are permissions will take effect faster (default is 2 hours)
Value name: Reread Logon Quotas Interval
Radix: Decimal
Value data: 1200 (20 Minutes)

Value name: Mailbox Cache Age Limit
Data Type: REG_DWORD
Radix: Decimal
Value data: 1200 (20 Minutes)

5. Move TEMP/TMP folders to RAID 1 partition
- Exchange uses TMP folders for mailbox moves

6. Increase ESE Buffer Size
- To optimize Virtual Memory useage by ESE, EXBPA recommends that servers with more that 2 GB of memory set the following:
Start the Active Directory Service Interfaces (ADSI) Edit utility.
Under Configuration Container, expand CN=Configuration, DC=example, DC=com.
Expand CN=Services, expand CN=Microsoft Exchange, expand CN=OrganizationName, expand CN=Administrative Groups, expand CN=First Administrative, expand CN=Servers, and then expand CN=servername.
Under CN=servername, right-click CN=InformationStore, and then click Properties.
In the Select which properties to view list, click Both.
In the Select a property to view list, click msExchESEParamCacheSizeMax
In the Edit Attribute box, type 311296 (1.2 GB)

7. Increase Transaction Log Buffers
- Increasing the size will provide better performance when multiple transactions are occuring (ideal for corporate environments). EXBPA recommends that if this value be changed to 9000.
Under Configuration Container, expand CN=Configuration, DC=example, DC=com.
Expand CN=Services, expand CN=Microsoft Exchange, expand CN=OrganizationName, expand CN=Administrative Groups, expand CN=First Administrative, expand CN=Servers, and then expand CN=servername.
Under CN=servername, right-click CN=InformationStore, right-click CN=, and then click Properties
In the Select a property to view list, click msExchESEParamLogBuffers
In the Edit Attribute box, type 9000

Thursday, March 23, 2006

Account Expires Attribute

I came across a posting today where someone wanted to set the account expires attribute to never using LDIFDE. It can be done using ldifde and using the ds tools.
LDIFDE or how I learned to love DS tools
C:\>ldifde -d "ou=test,dc=lab,dc=com" -s dcname -r "(&(cn=*))" -l accountexpires -f accExpires.txt

Here's what you'll get
----- Begin File: proxies.txt-----
dn: CN=Heras, Teo,ou=test,dc=lab,dc=com
changetype: add
accountExpires: 9223372036854775807
----- End File-----

Edit the file so it looks like this:
----- Begin File: proxies.txt -----
dn: CN=Heras, Teo,ou=test,dc=lab,dc=com
changetype: modify <---- change from add to modify
replace: accountExpires <---- This was added
accountExpires: 0 <----- this means never
- <---This is critical and the log file will tell you
----- End File -----

Finally, import the changes

c:\ldifde -i -f proxies.txt -s dcname -j c:-i means import, -j c:
DS Tools
dsquery user "ou=NoExpireDate,dc=lab,dc=com" | dsmod user -acctExpires Never

Wednesday, March 22, 2006

WMI Monitoring Script

I came into a situation where there are several Exchange servers without any monitoring. While software is procured, I created the following script to do some basic monitoring of Exchange services and disk space (to make sure circular logging doesn't kill the server). I have the script running as a scheduled task every 15 minutes. The script will create a log file every time it runs. If one of the thresholds is reached, an email is sent.

On Error Resume Next
Const ForAppending=8
Const ForReading=1
Const ForWritting=2
Dim strComputer
Dim objWMIService
Dim propValue
Dim objItem
Dim SWBemlocator
Dim UserName
Dim Password
Dim colItems

'Create Log file
Set objFSO = CreateObject("Scripting.FileSystemObject")
strPath = "C:\WMI Monitoring\"
strFileName = "server_status" & Hour(Now) & Minute(Now) & ".log"
strFullName = objFSO.BuildPath(strPath, strFileName)
Set objFile = objFSO.CreateTextFile(strFullName)
Set objFile = objFSO.OpenTextFile(strFullName, ForWritting)
'Build array of servers
arrServers = Array("exchange01", "exchange02")

'username and password
strUserName = "Administrator"
strPassword = "Password1"

For Each strComputer In arrServers
'WScript.Echo strComputer
ObjFile.writeline "===================================="
ObjFile.writeline "Computer: "& strComputer
ObjFile.writeline "===================================="
Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = SWBemlocator.ConnectServer(strComputer,"root\CIMV2",strUserName,strPassword)
If Err.Number = "-2147023174" Then
strAlertItem = Err.Description
strAlertThreshold = "!!"
Call SendAlert(strComputer, strAlertItem, strAlertThreshold)
End If
If Err.Number <> 0 Then
objFile.WriteLine "Error Connecting: " & Err.Number & " " & Err.Description
End If

'Check Logical Disk
Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk",,48)
objfile.WriteLine "Checking Free Disk Space"
For Each objItem In colItems
If InStr(objItem.Description, "Fixed Disk") Then
strAlertItem = objItem.DeviceID & ", " & objItem.Description
intFreeSpace = objItem.FreeSpace
intFreeSpace = intFreeSpace/1048576
strAlertThreshold = "Free SPace: " & CLng(intFreeSpace) & " MB"
'If there are less than 200 MB of Free Disk Space then send out an alert
If intFreeSpace < 200 Then
Call SendAlert(strComputer, strAlertItem, strAlertThreshold)
End If
objfile.WriteLine strAlertItem
objFile.WriteLine strAlertThreshold
objFile.writeline " "
End If
'Check Status of Services
Set colItems = objWMIService.ExecQuery("Select * from Win32_Service",,48)
objfile.WriteLine "Checking Exchange Services"
For Each objItem in colItems
If InStr(objItem.Displayname, "Exchange") Then
If InStr(objItem.Displayname, "Sync") Then
'WScript.Echo objItem.DisplayName
ElseIf InStr(objItem.Displayname, "Lotus") Then
'WScript.Echo objItem.Displayname
ElseIf InStr(objItem.Displayname, "Mailbox Manager") Then
'WScript.Echo objItem.Displayname
objfile.WriteLine "DisplayName: " & objItem.DisplayName
objfile.WriteLine "Name: " & objItem.Name
objfile.WriteLine "State: " & objItem.State
objfile.WriteLine "Status: " & objItem.Status
objfile.WriteLine " "
If objItem.State = "Stopped" Then
strAlertItem = objItem.Name & ":"
strAlertThreshold = objItem.State
Call SendAlert(strComputer, strAlertItem, strAlertThreshold)
End If
End If
End If
strAlertItem = " "
strAlertThreshold = " "
Set objWMIService = Nothing
Set objFSO = Nothing

'Send Alerts Via Email
Function SendAlert(strComputer, strAlertItem, strAlertThreshold)
'WScript.Echo "Sent Alert"
Set objEmail = CreateObject("CDO.Message")
objEmail.From = strComputer & ""
objEmail.To = ";"
objEmail.Subject = "Server Alert"
strText = strComputer & " is having the following problems: " & strAlertItem & strAlertThreshold
objFile.WriteLine "********************** ALERT SENT ********************************"
objEmail.TextBody = strText
objEmail.Configuration.Fields.Item ("") = 2
objEmail.Configuration.Fields.Item ("") = "nsmail01"
objEmail.Configuration.Fields.Item ("") = 25
End Function