The cmdlet set-casmailbox can be used to configure Outlook Web Access segmentation for individual users. As an example, you can disable the premium client for a particular mailbox through the following command:
set-casmailbox teod -owapremiumclientenabled:$false
However, what happens is that all the other segmentation features get disabled. You can see this by running the following command:
get-casmailbox teod format-list
*** OUTPUT*********************************
OWARemindersAndNotificationsEnabled : False
OWAPremiumClientEnabled : False
OWASpellCheckerEnabled : False
*********************************************
Behind the scenes, the set-casmailbox cmdlet is setting a value on the AD attribute, msExchMailboxFolderSet which controls mailbox segmentation. So, to reset this back to default, set this attribute to $Null, or Not Set either through ADSI Edit or through Powershell. Alternatively, you can enable all the settings by setting the value of msExchMailboxFolderSet to 2147483647.
In production, you should find out what segmentation settings you want for a particular subset of users, configure those settings on one user, and then copy the value from the attribute: msExchMailboxFolderSet, to all of the users that require segmented OWA.
Sunday, November 02, 2008
Wednesday, October 29, 2008
Exchange 2007 SP1 SCC
I found a blog that details how to configure an Exchange 20078 SCC with iSCSI:
http://www.shudnow.net/2008/03/13/exchange-2007-sp1-scc-using-server-2008-starwind-iscsi-part-1/
http://www.shudnow.net/2008/03/13/exchange-2007-sp1-scc-using-server-2008-starwind-iscsi-part-1/
Monday, October 27, 2008
Create Managed Distribution Groups through powershell
I recently had to create 85 managed groups; groups where users manage their memembership (instead of admins). I wrote a powershell script to create the groups, mail-enable them, set the managedby attribute, and associated AD permissions.
I created an csv with the following headings:
Alias , DisplayName, ManagedBy
*The ManagedBy field must contain a DN
Add-PSSnapin Quest.ActiveRoles.ADManagement
[array]$group_info = import-csv "C:\group_info.csv"
$group_info ForEach-Object {
$gname = $_.dispname
$gdesc = $gname
$gAlias = $_.Alias
$gsam = $gAlias
$gmanager = $_.managedby
$gmanager = "CN=De Las Heras\, Teo,CN=Users,DC=Company,DC=org"
#For Debugging, write out the variables (tab delimited)
# Write-Host $gname, `t,$gAlias, `t, $gmanager
$objOU = [ADSI]"OU=Groups,DC=Company,DC=ORG"
$gcn = "cn=" + $gname
$objGroup = $objOU.Create("group", $gcn)
$objGroup.Put("sAMAccountName", $gsam)
$objGroup.Put("groupType", "-2147483646")
$objGroup.Put("description", $gdesc)
$objGroup.Put("displayName", $gname)
$objGroup.Put("mailnickname", $gsam)
$objGroup.put("managedby", $gmanager)
$objGroup.setinfo()
add-qadpermission -service 'servername' $gname -Account 'Company\tdelasheras' -Rights 'WriteProperty' -Property 'Member'
}
I created an csv with the following headings:
Alias , DisplayName, ManagedBy
*The ManagedBy field must contain a DN
Add-PSSnapin Quest.ActiveRoles.ADManagement
[array]$group_info = import-csv "C:\group_info.csv"
$group_info ForEach-Object {
$gname = $_.dispname
$gdesc = $gname
$gAlias = $_.Alias
$gsam = $gAlias
$gmanager = $_.managedby
$gmanager = "CN=De Las Heras\, Teo,CN=Users,DC=Company,DC=org"
#For Debugging, write out the variables (tab delimited)
# Write-Host $gname, `t,$gAlias, `t, $gmanager
$objOU = [ADSI]"OU=Groups,DC=Company,DC=ORG"
$gcn = "cn=" + $gname
$objGroup = $objOU.Create("group", $gcn)
$objGroup.Put("sAMAccountName", $gsam)
$objGroup.Put("groupType", "-2147483646")
$objGroup.Put("description", $gdesc)
$objGroup.Put("displayName", $gname)
$objGroup.Put("mailnickname", $gsam)
$objGroup.put("managedby", $gmanager)
$objGroup.setinfo()
add-qadpermission -service 'servername' $gname -Account 'Company\tdelasheras' -Rights 'WriteProperty' -Property 'Member'
}
Tuesday, October 21, 2008
Powershell - Get status of Exchange databases
The Exchange Management Shell (EMS) provides a way to output the status of Exchange Databases through the command, get-mailboxdatabase. Note that you must include the -status switch in order to get the proper output.
get-mailboxdatabase select Mounted - will give you nothing.
The correct command is
get-mailboxdatabase -status Select Name, Mounted, LastFullBackup
I have a small script I wrote that get's the status of all the databases in my organization and sends me an e-mail if a database is dismounted. I have the script running as a scheduled task. Here it is:
**Save this a a .ps1 file ** It'll need to be signed as well
function Send-Mail
{
Param($sbj,$msg,$to,[switch]$html)
$SmtpClient = new-object system.net.mail.smtpClient
$MailMessage = New-Object system.net.mail.mailmessage
$SmtpClient.Host = 'relayserver'
$mailmessage.from = 'fromme@company.com'
$mailmessage.To.add($to)
$mailmessage.Subject = $sbj
if($html)
{
$mailmessage.IsBodyHtml = 1
$mailmessage.Body = $msg
}
else
{
$mailmessage.Body = $msg
}
$smtpclient.Send($mailmessage)
}
function exch-status {
get-mailboxdatabase -status %{$DBName = $_.Name; $DBMounted = $_.Mounted; $DBBackup = $_.LastFullBackup}
if ($DBMounted -eq $False )
{
$Message = "The database $DBName is unmounted. Please page Sys Admin immediately."
Send-Mail 'Exchange DB Unmounted' $Message 'copmpanyops@company.com'
}
$DateToday = Get-Date
if($DBBackup.day -lt $DateToday.day)
{
Message = "It's been 24 hours since a full backup completed successfully."
Send-Mail 'Full Backup has not run' $Message 'copmpanyops@company.com'
}
}
exch-status
****End of Script ****
get-mailboxdatabase select Mounted - will give you nothing.
The correct command is
get-mailboxdatabase -status Select Name, Mounted, LastFullBackup
I have a small script I wrote that get's the status of all the databases in my organization and sends me an e-mail if a database is dismounted. I have the script running as a scheduled task. Here it is:
**Save this a a .ps1 file ** It'll need to be signed as well
function Send-Mail
{
Param($sbj,$msg,$to,[switch]$html)
$SmtpClient = new-object system.net.mail.smtpClient
$MailMessage = New-Object system.net.mail.mailmessage
$SmtpClient.Host = 'relayserver'
$mailmessage.from = 'fromme@company.com'
$mailmessage.To.add($to)
$mailmessage.Subject = $sbj
if($html)
{
$mailmessage.IsBodyHtml = 1
$mailmessage.Body = $msg
}
else
{
$mailmessage.Body = $msg
}
$smtpclient.Send($mailmessage)
}
function exch-status {
get-mailboxdatabase -status %{$DBName = $_.Name; $DBMounted = $_.Mounted; $DBBackup = $_.LastFullBackup}
if ($DBMounted -eq $False )
{
$Message = "The database $DBName is unmounted. Please page Sys Admin immediately."
Send-Mail 'Exchange DB Unmounted' $Message 'copmpanyops@company.com'
}
$DateToday = Get-Date
if($DBBackup.day -lt $DateToday.day)
{
Message = "It's been 24 hours since a full backup completed successfully."
Send-Mail 'Full Backup has not run' $Message 'copmpanyops@company.com'
}
}
exch-status
****End of Script ****
Saturday, October 18, 2008
Exchange Availability Service
Free/Busy Tutorial:
http://blogs.msdn.com/deva/archive/2008/10/13/tutorial-free-busy-data.aspx
The availability serive replaced the free/busy PF from Exchange 2003. To see how many availability services exist:
get-autodiscovervirtualdirectory
Basically, Exchange publishes the availability service through a Service Connection Point in Active Directory. The location of the Service Connection Point is in the serviceBindingInformation attribute on the following object:
CN=DC1,CN=Autodiscover,CN=Protocols,CN=DC1,CN=Servers,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=Litware Inc,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=litwareinc,DC=com
Test the Exchange Availability Service:
Test-OutlookWebServices -id:user1@contoso.com -TargetAddress: user2@contoso.com
If the service is not functioning, it's easy to rebuild:
Remove-autodiscovervirtualdirectory
New-Autodiscovervirtualdirectory
http://blogs.msdn.com/deva/archive/2008/10/13/tutorial-free-busy-data.aspx
The availability serive replaced the free/busy PF from Exchange 2003. To see how many availability services exist:
get-autodiscovervirtualdirectory
Basically, Exchange publishes the availability service through a Service Connection Point in Active Directory. The location of the Service Connection Point is in the serviceBindingInformation attribute on the following object:
CN=DC1,CN=Autodiscover,CN=Protocols,CN=DC1,CN=Servers,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=Litware Inc,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=litwareinc,DC=com
Test the Exchange Availability Service:
Test-OutlookWebServices -id:user1@contoso.com -TargetAddress: user2@contoso.com
If the service is not functioning, it's easy to rebuild:
Remove-autodiscovervirtualdirectory
New-Autodiscovervirtualdirectory
Exchange 2007 - Healthy Configuration
Exchange 2007 System Requirements (note: Page File should be RAM + 10 MB):
http://technet.microsoft.com/en-us/library/aa996719.aspx
Memory Requirements (note: minimum memory / # of storage groups):
http://technet.microsoft.com/en-us/library/bb738124(EXCHG.80).aspx
Steps to mitigate excessive paging:
http://blogs.technet.com/mikelag/archive/2008/10/17/steps-to-help-mitigate-excessive-paging-and-working-set-trimming-issues.aspx
http://technet.microsoft.com/en-us/library/aa996719.aspx
Memory Requirements (note: minimum memory / # of storage groups):
http://technet.microsoft.com/en-us/library/bb738124(EXCHG.80).aspx
Steps to mitigate excessive paging:
http://blogs.technet.com/mikelag/archive/2008/10/17/steps-to-help-mitigate-excessive-paging-and-working-set-trimming-issues.aspx
Friday, October 06, 2006
Unable to establish email address
I came across the following problem today:
http://support.microsoft.com/?id=905809
Basically, after applying Windows 2003 SP1, only server local admins are able to establish SMTP addresses for objects (contacts, mailboxes, etc...). The error the user was getting was:
"An Exchange Server could not be found in the domain".
The jist is that non-local admins are not allowed to query for the status of the system attendant.
Teo
http://support.microsoft.com/?id=905809
Basically, after applying Windows 2003 SP1, only server local admins are able to establish SMTP addresses for objects (contacts, mailboxes, etc...). The error the user was getting was:
"An Exchange Server could not be found in the domain".
The jist is that non-local admins are not allowed to query for the status of the system attendant.
Teo
Tuesday, August 01, 2006
A closer look at DSAccess
Neil Hobson has posted an article to msexchange.org that covers in detail the dsaccess process. I learned that you can tell Exchange 2003 to not connect to a GC that is also a PDC. As Neil explains it, the PDC can become overwhelmed at times (password changes).
Key: HKLM\System\CurrentControlSet\Services\MSExchangeDSAccess\Profiles\Default
Value: MinUserDC
Type: REG_DWORD
Teo
Key: HKLM\System\CurrentControlSet\Services\MSExchangeDSAccess\Profiles\Default
Value: MinUserDC
Type: REG_DWORD
Teo
Wednesday, May 17, 2006
FSMO Role Placement
Good article on FSMO role lacement within AD.
http://www.windowsdevcenter.com/pub/a/windows/2004/06/15/fsmo.html
http://www.windowsdevcenter.com/pub/a/windows/2004/06/15/fsmo.html
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
http://www.microsoft.com/technet/prodtechnol/exchange/2003/wontmount.mspx
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.
Teo
What to do when an Exchange Store won't mount
http://www.microsoft.com/technet/prodtechnol/exchange/2003/wontmount.mspx
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.
Teo
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)
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSExchangeIS\ParametersSystem
Value name: Reread Logon Quotas Interval
Dta Type: REG_DWORD
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
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)
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSExchangeIS\ParametersSystem
Value name: Reread Logon Quotas Interval
Dta Type: REG_DWORD
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=
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
********************************************
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)
objFile.Close
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
Err.Clear
'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)
Err.Clear
End If
If Err.Number <> 0 Then
objFile.WriteLine "Error Connecting: " & Err.Number & " " & Err.Description
Err.Clear
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
Next
'*****************************************************************************************************
'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
Else
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
Next
strAlertItem = " "
strAlertThreshold = " "
Set objWMIService = Nothing
Next
objfile.Close
Set objFSO = Nothing
'*****************************************************************************************************
'Send Alerts Via Email
'*****************************************************************************************************
Function SendAlert(strComputer, strAlertItem, strAlertThreshold)
'WScript.Echo "Sent Alert"
Set objEmail = CreateObject("CDO.Message")
objEmail.From = strComputer & "@company.org"
objEmail.To = "teo@inventrix.net;5551212@pager.net"
objEmail.Subject = "Server Alert"
strText = strComputer & " is having the following problems: " & strAlertItem & strAlertThreshold
objFile.WriteLine "********************** ALERT SENT ********************************"
objEmail.TextBody = strText
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "nsmail01"
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
End Function
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)
objFile.Close
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
Err.Clear
'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)
Err.Clear
End If
If Err.Number <> 0 Then
objFile.WriteLine "Error Connecting: " & Err.Number & " " & Err.Description
Err.Clear
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
Next
'*****************************************************************************************************
'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
Else
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
Next
strAlertItem = " "
strAlertThreshold = " "
Set objWMIService = Nothing
Next
objfile.Close
Set objFSO = Nothing
'*****************************************************************************************************
'Send Alerts Via Email
'*****************************************************************************************************
Function SendAlert(strComputer, strAlertItem, strAlertThreshold)
'WScript.Echo "Sent Alert"
Set objEmail = CreateObject("CDO.Message")
objEmail.From = strComputer & "@company.org"
objEmail.To = "teo@inventrix.net;5551212@pager.net"
objEmail.Subject = "Server Alert"
strText = strComputer & " is having the following problems: " & strAlertItem & strAlertThreshold
objFile.WriteLine "********************** ALERT SENT ********************************"
objEmail.TextBody = strText
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "nsmail01"
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
End Function
Saturday, February 25, 2006
Microsoft Logos
I just found the following link on Microsofts site. If your certified in Microsoft technology, there's a new way to download logos.
https://www.certificationlogobuilder.com/default.aspx
Teo
https://www.certificationlogobuilder.com/default.aspx
Teo
Tuesday, February 21, 2006
How to recreate Exchange IIS virtual directories
Brian Posey wrote an article that is worth taking note of. He explains how to recreate the IIS virtual directories for OWA. This can be useful if there is corruption in the metabase, or if data deletion occurs to the files and folders needed.
Link to the article:
http://searchexchange.techtarget.com/general/0,295582,sid43_gci1167561,00.html?track=NL-368&ad=541160
Overview of steps:
1. Backup IIS - This will ensure that further damage isn't done
2. Delete all the IIS virtual directories
a. Exadmin, Exchange, ExchWeb, Microsoft-Server-ActiveSync, OMA, and Public directories.
3. Delete the DS2MB metadata using Metabase Exploerer (IIS Resource Kit)
a. DS2MB stands for Directory Service to Metabase. It exists to bring over configuration information from AD to IIS. Remember that some OWA administration is actually done through ESM. Those changes come over with the help of DS2MB. I'm assuming that when DS2MB is deleted, the virtual directories are repopulated using the information in AD.
4. Restart the System Attendant and/or reboot the server to recreate the virtual directories.
5. Reset permissions on the ExchWeb virtual directory.
a. The article recommends enabling anonymous access and integrated Windows authentication on the ExchWeb directory. Anonymous access was already enabled when I tried this in my lab, and Integrated Windows Authentication was not needed.
KB Articles:
Overview of DS2MB
How to reset default virtual directories that are required to Provide Outlook Web Access, Exchange ActiveSync, and OMA
Link to the article:
http://searchexchange.techtarget.com/general/0,295582,sid43_gci1167561,00.html?track=NL-368&ad=541160
Overview of steps:
1. Backup IIS - This will ensure that further damage isn't done
2. Delete all the IIS virtual directories
a. Exadmin, Exchange, ExchWeb, Microsoft-Server-ActiveSync, OMA, and Public directories.
3. Delete the DS2MB metadata using Metabase Exploerer (IIS Resource Kit)
a. DS2MB stands for Directory Service to Metabase. It exists to bring over configuration information from AD to IIS. Remember that some OWA administration is actually done through ESM. Those changes come over with the help of DS2MB. I'm assuming that when DS2MB is deleted, the virtual directories are repopulated using the information in AD.
4. Restart the System Attendant and/or reboot the server to recreate the virtual directories.
5. Reset permissions on the ExchWeb virtual directory.
a. The article recommends enabling anonymous access and integrated Windows authentication on the ExchWeb directory. Anonymous access was already enabled when I tried this in my lab, and Integrated Windows Authentication was not needed.
KB Articles:
Overview of DS2MB
How to reset default virtual directories that are required to Provide Outlook Web Access, Exchange ActiveSync, and OMA
Monday, February 20, 2006
Delegating Admin Tasks
I'm a big fan of delegating only the admin rights that people need. It's easier to just give everyone full rights, but that's not very Elegant. Anyway, I read an article at ActiveDir.org today that corvers how to create a taskpad to delegate common administrative tasks.
http://www.activedir.org/article.aspx?aid=84
http://www.activedir.org/article.aspx?aid=84
Friday, February 17, 2006
HP Remote Management / ILO
Had an issue today where we needed to change the IP address of the ILO card. Normally, this can be done through one of two ways:
1. Through the ILO interface
a. https://iloipaddress
2. By rebooting the server and pressing F8
Neither of these methods was an option which allowed us to find a Utility from HP called "HP Lights-Out Online Configuration Utility." Its basically a command line tool that takes an XML file as input for ILO configuration settings. To get the utility to work, we had to install the following:
1. HP Proliant iLO Advanced and Enhanced System Management Controller Driver
2. HP Proliant Integrated Lights-Out Management Interface Driver
3. HP Lights-Out Online Configuration Utility
4. HP Insight Diagnostics Online Edition
Not sure which ones are needed, but the utility wouldn't work untill we installed all of the above.
Steps to change IP address:
1. C:\>hponcfg /w ilo_ip.xml - Exports configuration
2. Edit ilo_ip.xml to reflect new IP address
3. C:\>hponcfg /f ilo_ip.xml - Imports configuration
In the documentation, I also saw that this could be used to change the password.
Teo
1. Through the ILO interface
a. https://iloipaddress
2. By rebooting the server and pressing F8
Neither of these methods was an option which allowed us to find a Utility from HP called "HP Lights-Out Online Configuration Utility." Its basically a command line tool that takes an XML file as input for ILO configuration settings. To get the utility to work, we had to install the following:
1. HP Proliant iLO Advanced and Enhanced System Management Controller Driver
2. HP Proliant Integrated Lights-Out Management Interface Driver
3. HP Lights-Out Online Configuration Utility
4. HP Insight Diagnostics Online Edition
Not sure which ones are needed, but the utility wouldn't work untill we installed all of the above.
Steps to change IP address:
1. C:\>hponcfg /w ilo_ip.xml - Exports configuration
2. Edit ilo_ip.xml to reflect new IP address
3. C:\>hponcfg /f ilo_ip.xml - Imports configuration
In the documentation, I also saw that this could be used to change the password.
Teo
Tuesday, February 14, 2006
Troubleshooting mail delivery and queues
Had an issue late this afternoon where the queue "messages awaiting directory lookup" had over 5K messages in it. I wanted to point to the following documents which detail how to troubleshoot each queue:
Troubleshooting Mail Flow and SMTP
Exchange Transport and Routing Guide
Modifying Logging Settings for MSExchangeTransport
Exchange Transport and Routing Guide
Basically, Queue buildup in "messages awaiting directory lookup" is related to AD connectivity. Here's a couple of ways to test AD connectivity:
telnet dcname 389 / 3268 (dc / gc)
lpd dcname 389 / 3268 (dc / gc)
dcdiag dcname
It turns out that one of the sites only has a single domain controller, which was probably overwhelmed. Lesson: Exchange needs at least two domain controllers local to it's site. Connectivity re-established by itself, but the queue continued to grow. We tried restarting the SMTP service, but it was stuck in a stopping state. There's a couple options available for this situation:
1. Force the smtpsvc to stop:
sc stop smtpsvc /force
2. Issue an iisreset /restart command which will bring down all the services related to inetinfo.exe (including SMTP).
IIS Library
It's important to note that if IISreset cannot bring down inetinfo.exe gracefully, then it will force it to stop. This can be avoided by providing the /noforce switch.
Teo
Troubleshooting Mail Flow and SMTP
Exchange Transport and Routing Guide
Modifying Logging Settings for MSExchangeTransport
Exchange Transport and Routing Guide
Basically, Queue buildup in "messages awaiting directory lookup" is related to AD connectivity. Here's a couple of ways to test AD connectivity:
telnet dcname 389 / 3268 (dc / gc)
lpd dcname 389 / 3268 (dc / gc)
dcdiag dcname
It turns out that one of the sites only has a single domain controller, which was probably overwhelmed. Lesson: Exchange needs at least two domain controllers local to it's site. Connectivity re-established by itself, but the queue continued to grow. We tried restarting the SMTP service, but it was stuck in a stopping state. There's a couple options available for this situation:
1. Force the smtpsvc to stop:
sc stop smtpsvc /force
2. Issue an iisreset /restart command which will bring down all the services related to inetinfo.exe (including SMTP).
IIS Library
It's important to note that if IISreset cannot bring down inetinfo.exe gracefully, then it will force it to stop. This can be avoided by providing the /noforce switch.
Teo
Subscribe to:
Posts (Atom)