Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

I need to do some activity on exchange server which can be counted as an value add to my organisation

Posted on 2015-02-02
3
Medium Priority
?
64 Views
Last Modified: 2015-02-19
Hi Team,

I need to do some activity in exchange server 2010 which can be counted as an value add to my organization.
For example, One of my colleague has make a script for exchange health monitoring. I also need to do some activity or prepare some script which is beneficial for my team in exchange server 2010.
0
Comment
Question by:Manish Kumar
[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
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
Rezwan Islam earned 1500 total points
ID: 40585400
I have got a little one if you are using DAG. You can use the following script to automate DAG failback and send out an alert.

#================start-of-script=======================

Function sendEmail ([String] $body)
{
      $MailMessage = New-Object System.Net.Mail.MailMessage
      $MailMessage.From = "exchange-dag@yourdomain.com"
      $MailMessage.To.Add("user1@yourdomain.com,user2@yourdomain.com,user3@yourdomain.com")
      $MailMessage.Subject = "Exchange DAG Not Healthy! switchback has now been initiated."
      $MailMessage.Body = $body
      $MailMessage.Priority = "High"

      $SMTPClient = New-Object System.Net.Mail.SMTPClient
      $SMTPClient.Host = "smpt.yourdomain.com"
      $SMTPClient.Send($MailMessage)
}

[Bool] $bolFailover = $False
[String] $errMessage = $null

Get-MailboxDatabase | Sort Name | ForEach {
      $db = $_.Name
      $xNow = $_.Server.Name
      $dbOwn = $_.ActivationPreference | ? {$_.Value -eq 1}

      If ($xNow -ne $dbOwn.Key)
      {
            $errMessage += "`n$db on $xNow should be on $($dbOwn.Key)!"
            $bolFailover = $True
            Start-Sleep -Seconds 5
            Move-ActiveMailboxDatabase -Server $xNow -Confirm:$false
      }
      
}

$errMessage += "`n`n"

Get-MailboxServer | Get-MailboxDatabaseCopyStatus | ForEach {
      If ($_.Status -notmatch "Mounted" -and $_.Status -notmatch "Healthy" -or $_.ContentIndexState -notmatch "Healthy")
      {
            $errMessage += "`n$($_.Name) - Status: $($_.Status) - Index: $($_.ContentIndexState)"
            $bolFailover = $True
      }
}

If ($bolFailover) { sendEmail $errMessage }

#=================end-of-script=======================
0
 
LVL 1

Author Comment

by:Manish Kumar
ID: 40585978
Hi Rezwan,

it is really nice. May i know how to run this and how can automate this so that it can work without any manual intervention.
0
 
LVL 3

Expert Comment

by:Rezwan Islam
ID: 40587667
You can create a CMD file using the following context and then set up a schedule task to call the CMD file to automate this failback process.

Paste the above script in a notepad and save as NotifyDBFailover.ps1. Paste the following batch commands in a notepad and save it as a NotifyDBFailover.CMD file and keep both these files under a folder called, lets say, C:\Scripts

#================CMD-FILE-CONTYEXT=============
@echo off
Powershell.exe -Command ".'C:\Program Files\Microsoft\Exchange Server\V14\Bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; C:\scripts\NotifyDBFailover.ps1"

#===============CMD-FILE-END===================

Then on the schedule task Action tab, select
Action: Start a program
Under Settings section, program/script: C:\Scripts\NotifyDBFailover.cmd
Start in (Optional): C:\Scripts

You can set a trigger for every 30 minutes.

Hope this helps.
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

Know the reasons and solutions to move/import EDB to New Exchange Server. Also, find out how to recover an Exchange .edb file and to restore the file back.
With so many activities to perform, Exchange administrators are always busy in organizations. If everything, including Exchange Servers, Outlook clients, and Office 365 accounts work without any issues, they can sit and relax. But unfortunately, it…
In this video we show how to create a Shared Mailbox 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 >> Sha…
In this video we show how to create a Resource Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: Navigate to the Recipients >> Resources tab.: "Recipients" is our default selection …
Suggested Courses

597 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