DRIVE EFFICIENCY THROUGH AUTOMATED IT.
SAVE COST THROUGH CONSOLIDATION OF IT.
WANT TO KNOW MORE ABOUT STRATEGIC CONSULTING CLICK HERE.
MICROSOFT / RISUAL HYPER-V CLOUD EVENT 22ND MARCH 2011 CLICKHERE.

Archive

Author Archive

View what Public Folder Database your Mailbox Databases are pointing to in Exchange 2010

May 18th, 2012 Daniel Davies Comments off

Here is a quick simple command you can run to view what Public Folder Database your Mailbox Databases are pointing to in Exchange 2010.

Get-MailboxDatabase  | Sort-Object PublicFolderDatabase |  Ft Name, PublicFolderDatabase

 

This will give you an output like below

Name                                              PublicFolderDatabase
—-                                                        ——————–
DB1                                                    01-PF
DB2                                                   01-PF
DB3                                                   02-PF
DB4                                                   02-PF
DB5                                                   03-PF

Categories: Uncategorized Tags:

Cumulative Update 6 for System Center Operations Manager 2007 R2 has been released

May 17th, 2012 Daniel Davies Comments off

Cumulative Update 6 has been released for System Center Operations Manager 2007 R2, this CU fixes the below issues.

“Cumulative Update 6 for Operations Manager 2007 R2 resolves the following issues:

  • RMS promotion fails if NetworkName and PrincipalNames are not in sync for agents.
  • UI is limited to only 100 MB for the Memory Usage field in the wizard.
  • Additional OIDs in auth certificate are not processed correctly.
  • AEM creates duplicate computer objects in OpsMgr based on Agents NetBIOS name.
  • Cannot open reporting pane on OpsMgr 2007 R2 remote console.
  • Cannot view schedule for scheduled report.
  • ManagementServerConfigTool with the option "promoterms" fails because it stops polling the SDK Service.
  • OpsMgr reports are failing on Windows 7 with the error: "Cannot initialize report."
  • ACS events have "n/a" as their category in the ACS database.
  • Watch agentless monitoring listener to detect failure to respond.
  • SCOM SDK memory leak on cryptography keys and cryptography contexts.
  • After you click Edit Schedule, a message box appears, and you cannot save the change value.
  • Audit events can be lost when the AdtServer process crashes.

Cumulative Update 6 for Operations Manager 2007 R2 resolves the following cross-platform issues:

  • The installation process for the IBM AIX 6.1 agent incorrectly checks for AIX 5.3 packages.
  • After a system restart, the OpsMgr agent for Solaris may start to run before local file systems are mounted.
  • On Red Hat Linux version 4 and SUSE Linux version 9, LVM disks are not discovered and cannot be monitored.
  • The OpsMgr agent for AIX does not report the arguments for monitored processes.
  • When Microsoft security update MS12-006 is installed on an OpsMgr management server, that management server can no longer communicate with the OpsMgr agent on any Linux or UNIX server.
  • On HP-UX, OpsMgr cannot discover and monitor a logical volume that is composed of more than 127 physical volumes.

Cumulative Update 6 for Operations Manager 2007 R2 adds the following cross-platform features:

  • Support for IBM AIX 7.1 (POWER).
  • Support for Oracle Solaris 11 (x86 and SPARC).”

 

You can download the Cumulative update from http://www.microsoft.com/en-us/download/details.aspx?id=29850

Categories: Uncategorized Tags:

Set a Lagged Mailbox Database Copy in Exchange 2010

May 4th, 2012 Daniel Davies Comments off

Here is a quick simple command you can run to set a lagged copy time on a Database copy when it already exists.

The below command will set the  lag copy for 7 days behind (The maximum you can increase this to is 14 Days)

Set-MailboxDatabaseCopy –Identity DatabaseNameMailboxservername -ReplayLagTime 07.00:00:00

Categories: Uncategorized Tags:

CRM 2011 Rollup 8 Released

May 3rd, 2012 Daniel Davies Comments off

Just to let you know CRM 2011 Rollup 8  has been released Smile

You can download from the following location http://www.microsoft.com/en-us/download/details.aspx?id=29692&WT.mc_id=rss_alldownloads_all

Categories: Uncategorized Tags:

Update Rollup 2 for Exchange Server 2010 Service Pack 2 Released

April 27th, 2012 Daniel Davies Comments off

Just to let you know Update Rollup 2 for Exchange Server 2010 Service Pack 2 (KB2645995) has been released Smile

You can download the rollup from http://www.microsoft.com/en-us/download/details.aspx?id=29427

Rollup 2 contains the following fixes (Referenced from http://support.microsoft.com/?kbid=2661854)

Update Rollup 2 for Exchange Server 2010 SP2 resolves the issues that are described in the following Microsoft Knowledge Base (KB) articles:

  • A meeting request that is sent by an external user or by using a non-Microsoft email system is stamped as Busy instead of Tentative in an Exchange Server 2010 environment
  • Slow performance when you create many contacts by using Exchange Web Services in an Exchange Server 2010 environment
  • Email messages in the Sent Items folder have the same PR_INTERNET_MESSAGE_ID property in an Exchange Server 2010 environment
  • Customized contact objects revert to the default form after a public folder database replication in an Exchange Server 2010 environment
  • You cannot generate an OAB file that is larger than 2GB in an Exchange Server 2010 environment
  • A user can log on to a mailbox by using Outlook for Mac 2011 unexpectedly in an Exchange Server 2010 environment
  • MAPI_E_INVALID_PARAMETER errors occur when a MAPI application receives notifications in an Exchange Server 2010 environment
  • A hidden user is still displayed in the Organization information of Address Book in OWA in an Exchange Server 2010 environment
  • Event ID 3022 is logged and you cannot replicate a public folder from one Exchange Server 2010 server to another
  • Returned message items can disappear from the search results view when you use Outlook in online mode in an Exchange Server 2010 environment
  • Error message when you use the “Folder.Bind” method in an Exchange Server 2010 environment
  • An email message from an Exchange Server 2003 user is forwarded incorrectly to an external recipient of an Exchange Server 2010 user mailbox
  • A read receipt is not sent when a receiver does not expand a conversation to preview the message by using OWA in an Exchange Server 2010 environment
  • The Get-FederatedDomainProof cmdlet fails in an Exchange Server 2010 SP1 environment
  • An external email message is not delivered to mail-enabled public folders and you do not receive NDR messages in an Exchange Server 2010 environment
  • Updates for a meeting request are sent to all attendees directly in an Exchange Server 2010 environment
  • Text in tables is displayed incorrectly in the Conversation view in Outlook Web App in an Exchange Server 2010 environment
  • You encounter failures when you run the Test-EcpConnectivity cmdlet to test Exchange Control Panel connectivity in an Exchange Server 2010 environment
  • CPU resources are used up when you use the Set-MailboxMessageConfiguration cmdlet in an Exchange Server 2010 environment
  • “More than one mailbox has the same e-mail address” error message when you try to manage a mailbox in a tenant organization in an Exchange Server 2010 SP1 Hosting mode environment
  • An ActiveSync user cannot access a mailbox in an Exchange Server 2010 forest
  • An email address policy does not generate the email addresses of recipients correctly in an Exchange Server 2010 environment
  • OK button is not displayed when you change your password in Outlook Web App by using Firefox in an Exchange Server 2010 environment
  • Certain MailboxStatistics properties are not updated when a user uses a POP3 or IMAP4 client to access a mailbox in an Exchange 2010 environment
  • DPM protection agent service may stop responding on Exchange Server 2010 servers that are protected by System Center DPM 2010
  • Error message when you open an RTF email message that has inline attachments in an Exchange Server 2010 environment
  • A user in a trusted account forest cannot use the EMC to manage an Exchange Server 2010 SP2 server
  • Error message when you try to copy the Inbox folder to another folder in Outlook in online mode in an Exchange Server 2010 environment
  • The Microsoft Exchange File Distribution service consumes large amounts of memory in an Exchange Server 2010 environment
  • The user-agent information about an Exchange ActiveSync device is not updated in an Exchange Server 2010 environment
  • The display name of a contact in address book is empty in an Exchange Server 2010 environment
  • An EWS application crashes when it calls the GetStreamingEvents operation in an Exchange Server 2010 environment
  • Error message when a user who does not have a mailbox tries to move or delete an item that is in a shared mailbox by using Outlook Web App Premium
  • W3wp.exe consumes excessive CPU resources on Exchange Server 2010 Client Access servers when users open recurring calendar items in mailboxes by using Outlook Web App or EWS
  • EdgeTransport.exe process crashes in an Exchange Server 2010 environment
  • Whatif switch does not work in the Set-MoveRequest or Resume-MoveRequest cmdlet in an Exchange Server 2010 environment
  • Resource mailbox does not forward meeting request to delegates after one of the delegates’ mailbox is disabled in an Exchange Server 2010 environment
  • The update tracking information option does not work in an Exchange Server 2010 environment
  • File name of a saved attachment is incorrect when you use OWA in Firefox 8 in an Exchange Server 2010 environment
  • Incorrect delivery report when you send an email message to a recipient who has configured an external forwarding address in an Exchange Server 2010 environment
  • EdgeTransport.exe process crashes without sending an NDR message when you send a message to a distribution group in an Exchange Server 2010 environment
  • Day of the week is not localized in MailTips in Outlook Web App in an Exchange Server 2010 environment
  • You cannot log on to Outlook Web App when a proxy is set up in an Exchange Server 2010 environment
Categories: Uncategorized Tags:

Setting the Maximum Send and Receive Size for all users in a certain Distribution Group in Exchange 2010

April 27th, 2012 Daniel Davies Comments off

Here is a quick command you can run from the Exchange management shell which will set the Maximum Send and Receive Size for all users in the specified Distribution Group.

In The Below Example i’m setting the Send/Receive Limit to 100mb for all users in the Distribution Group called DG1.

Get-DistributionGroup DG1| Get-DistributionGroupMember | Set-Mailbox -MaxSendSize 100mb -MaxReceiveSize 100mb

Categories: Uncategorized Tags:

Force Mail in Transport Queue to Retry in Exchange 2010

April 5th, 2012 Daniel Davies Comments off

Just a quick useful command to force all mail in your transport queue to retry instead of waiting for the next retry time.

Retry-Queue -Identity “QueueName” -Resubmit $True

Categories: Uncategorized Tags:

Exchange PowerShell Command to View the last backup time of your Exchange Databases

April 5th, 2012 Daniel Davies Comments off

Just a quick useful command to show you the last time your Exchange databases were backed up.

Get-MailboxDatabase -Status | FT name, Last*

The command issues an output like below

image

Categories: Uncategorized Tags:

Detailed Exchange 2010 Health Check

March 30th, 2012 Daniel Davies Comments off

Please see below a handy PowerShell Script which will give you a health check on each individual Exchange server in your environment

The PowerShell Script will check the following

  • That all Exchange Databases are Mounted
  • Mapi Connectivity to all databases are working
  • ActiveSync Connectivity to each CAS Server is working
  • OWA Connectivity to each CAS server is working
  • Mailflow to Each Database is working
  • Main CAS Server Ports are open and working
  • IMAP is working on each server
  • POP3 is working on each server

Please note the test port function in the script is from the following http://gallery.technet.microsoft.com/scriptcenter/97119ed6-6fb2-446d-98d8-32d823867131

The Script will give an output like below but obviously with all other checks being there to.

image

 

Please save the below to a .PS1 file and run from the Exchange Management Shell.

######################Functions#################################################
function Test-Port{ 
<#   
.SYNOPSIS   
    Tests port on computer. 
   
.DESCRIPTION 
    Tests port on computer.
    
.PARAMETER computer 
    Name of server to test the port connection on.
     
.PARAMETER port 
    Port to test
      
.PARAMETER tcp 
    Use tcp port
     
.PARAMETER udp 
    Use udp port 
    
.PARAMETER UDPTimeOut
    Sets a timeout for UDP port query. (In milliseconds, Default is 1000) 
     
.PARAMETER TCPTimeOut
    Sets a timeout for TCP port query. (In milliseconds, Default is 1000)
                 
   To Do: 
        Add capability to run background jobs for each host to shorten the time to scan.         
    
.EXAMPLE   
    Test-Port -computer ‘server’ -port 80 
    Checks port 80 on server ‘server’ to see if it is listening 
   
.EXAMPLE   
    ‘server’ | Test-Port -port 80 
    Checks port 80 on server ‘server’ to see if it is listening
     
.EXAMPLE   
    Test-Port -computer @("server1","server2") -port 80 
    Checks port 80 on server1 and server2 to see if it is listening 
   
.EXAMPLE
    Test-Port -comp dc1 -port 17 -udp -UDPtimeout 10000
   
    Server   : dc1
    Port     : 17
    TypePort : UDP
    Open     : True
    
    Description
    ———–
    Queries port 17 (qotd) on the UDP port and returns whether port is open or not
      
.EXAMPLE   
    @("server1","server2") | Test-Port -port 80 
    Checks port 80 on server1 and server2 to see if it is listening 
     
.EXAMPLE   
    (Get-Content hosts.txt) | Test-Port -port 80 
    Checks port 80 on servers in host file to see if it is listening
    
.EXAMPLE   
    Test-Port -computer (Get-Content hosts.txt) -port 80 
    Checks port 80 on servers in host file to see if it is listening
       
.EXAMPLE   
    Test-Port -computer (Get-Content hosts.txt) -port @(1..59) 
    Checks a range of ports from 1-59 on all servers in the hosts.txt file     
           
#>  
[cmdletbinding( 
    DefaultParameterSetName = '', 
    ConfirmImpact = 'low' 
)] 
    Param( 
        [Parameter( 
            Mandatory = $True, 
            Position = 0, 
            ParameterSetName = '', 
            ValueFromPipeline = $True)] 
            [array]$computer, 
        [Parameter( 
            Position = 1, 
            Mandatory = $True, 
            ParameterSetName = '')] 
            [array]$port, 
        [Parameter( 
            Mandatory = $False, 
            ParameterSetName = '')] 
            [int]$TCPtimeout=1000, 
        [Parameter( 
            Mandatory = $False, 
            ParameterSetName = '')] 
            [int]$UDPtimeout=1000,            
        [Parameter( 
            Mandatory = $False, 
            ParameterSetName = '')] 
            [switch]$TCP, 
        [Parameter( 
            Mandatory = $False, 
            ParameterSetName = '')] 
            [switch]$UDP                                   
        ) 
    Begin { 
        If (!$tcp -AND !$udp) {$tcp = $True} 
        #Typically you never do this, but in this case I felt it was for the benefit of the function 
        #as any errors will be noted in the output of the report         
        $ErrorActionPreference = "SilentlyContinue" 
        $report = @() 
    } 
    Process {    
        ForEach ($c in $computer) { 
            ForEach ($p in $port) { 
                If ($tcp) {   
                    #Create temporary holder  
                    $temp = "" | Select Server, Port, TypePort, Open, Notes 
                    #Create object for connecting to port on computer 
                    $tcpobject = new-Object system.Net.Sockets.TcpClient 
                    #Connect to remote machine’s port               
                    $connect = $tcpobject.BeginConnect($c,$p,$null,$null) 
                    #Configure a timeout before quitting 
                    $wait = $connect.AsyncWaitHandle.WaitOne($TCPtimeout,$false) 
                    #If timeout 
                    If(!$wait) { 
                        #Close connection 
                        $tcpobject.Close() 
                        Write-Verbose "Connection Timeout" 
                        #Build report 
                        $temp.Server = $c 
                        $temp.Port = $p 
                        $temp.TypePort = "TCP" 
                        $temp.Open = "False" 
                        $temp.Notes = "Connection to Port Timed Out" 
                    } Else { 
                        $error.Clear() 
                        $tcpobject.EndConnect($connect) | out-Null 
                        #If error 
                        If($error[0]){ 
                            #Begin making error more readable in report 
                            [string]$string = ($error[0].exception).message 
                            $message = (($string.split(":")[1]).replace(‘"’,"")).TrimStart() 
                            $failed = $true 
                        } 
                        #Close connection     
                        $tcpobject.Close() 
                        #If unable to query port to due failure 
                        If($failed){ 
                            #Build report 
                            $temp.Server = $c 
                            $temp.Port = $p 
                            $temp.TypePort = "TCP" 
                            $temp.Open = "False" 
                            $temp.Notes = "$message" 
                        } Else{ 
                            #Build report 
                            $temp.Server = $c 
                            $temp.Port = $p 
                            $temp.TypePort = "TCP" 
                            $temp.Open = "True"   
                            $temp.Notes = "" 
                        } 
                    }    
                    #Reset failed value 
                    $failed = $Null     
                    #Merge temp array with report             
                    $report += $temp 
                }     
                If ($udp) { 
                    #Create temporary holder  
                    $temp = "" | Select Server, Port, TypePort, Open, Notes                                    
                    #Create object for connecting to port on computer 
                    $udpobject = new-Object system.Net.Sockets.Udpclient
                    #Set a timeout on receiving message
                    $udpobject.client.ReceiveTimeout = $UDPTimeout
                    #Connect to remote machine’s port               
                    Write-Verbose "Making UDP connection to remote server"
                    $udpobject.Connect("$c",$p)
                    #Sends a message to the host to which you have connected.
                    Write-Verbose "Sending message to remote host"
                    $a = new-object system.text.asciiencoding
                    $byte = $a.GetBytes("$(Get-Date)")
                    [void]$udpobject.Send($byte,$byte.length)
                    #IPEndPoint object will allow us to read datagrams sent from any source. 
                    Write-Verbose "Creating remote endpoint"
                    $remoteendpoint = New-Object system.net.ipendpoint([system.net.ipaddress]::Any,0)
                    Try {
                        #Blocks until a message returns on this socket from a remote host.
                        Write-Verbose "Waiting for message return"
                        $receivebytes = $udpobject.Receive([ref]$remoteendpoint)
                        [string]$returndata = $a.GetString($receivebytes)
                        If ($returndata) {
                           Write-Verbose "Connection Successful" 
                            #Build report 
                            $temp.Server = $c 
                            $temp.Port = $p 
                            $temp.TypePort = "UDP" 
                            $temp.Open = "True" 
                            $temp.Notes = $returndata  
                            $udpobject.close()  
                        }                      
                    } Catch {
                        If ($Error[0].ToString() -match "bRespond after a period of timeb") {
                            #Close connection 
                            $udpobject.Close() 
                            #Make sure that the host is online and not a false positive that it is open
                            If (Test-Connection -comp $c -count 1 -quiet) {
                                Write-Verbose "Connection Open" 
                                #Build report 
                                $temp.Server = $c 
                                $temp.Port = $p 
                                $temp.TypePort = "UDP" 
                                $temp.Open = "True" 
                                $temp.Notes = ""
                            } Else {
                                <#
                                It is possible that the host is not online or that the host is online, 
                                but ICMP is blocked by a firewall and this port is actually open.
                                #>
                                Write-Verbose "Host maybe unavailable" 
                                #Build report 
                                $temp.Server = $c 
                                $temp.Port = $p 
                                $temp.TypePort = "UDP" 
                                $temp.Open = "False" 
                                $temp.Notes = "Unable to verify if port is open or if host is unavailable."                                
                            }                        
                        } ElseIf ($Error[0].ToString() -match "forcibly closed by the remote host" ) {
                            #Close connection 
                            $udpobject.Close() 
                            Write-Verbose "Connection Timeout" 
                            #Build report 
                            $temp.Server = $c 
                            $temp.Port = $p 
                            $temp.TypePort = "UDP" 
                            $temp.Open = "False" 
                            $temp.Notes = "Connection to Port Timed Out"                        
                        } Else {                     
                            $udpobject.close()
                        }
                    }    
                    #Merge temp array with report             
                    $report += $temp 
                }                                 
            } 
        }                 
    } 
    End { 
        #Generate Report 
        $report
    }
}

############################Variables########################################
$Yes = "Green"
$No = "Red"

 

#######################################Script################################
"`n"
Write-Host "Exchange Checks"
Write-Host "________________________________"
"`n"

# Check to make sure all databases are mounted

$MountedDB = get-mailboxdatabase -status
Write-Host "Databases Mounted"
"`n"
$Status = "Yes"
Foreach ($DB in $MountedDB)
{Write-host $DB.Name =  -NoNewline;
If ($DB.Mounted -ne $true)
{ $Status = ‘No’
}

if ($status -eq "Yes")
{Write-host -Foregroundcolor $Yes " Yes"
}

else
{Write-Host -ForegroundColor $No " No"}
}
"`n"
"`n"
############################################################################

# Test Mapi Connectivity to each Database

$MAPI = get-mailboxdatabase | Test-MapiConnectivity
Write-Host "Mapi Connectivity "
"`n"

$Status = "Yes"
Foreach ($db in $Mapi)
{Write-host $db.Database =  -NoNewline;
If ($DB.Result.value -ne "Success")
{ $Status = ‘No’
}

 

if ($status -eq "Yes")
{Write-host -Foregroundcolor $Yes " Yes"
}

else
{Write-Host -ForegroundColor $No " No"}
}
"`n"
"`n"
############################################################################

# Test ActiveSync Connectivity to each Server

$AS = Get-ClientAccessServer |   Test-ActiveSyncConnectivity
 
Write-Host "ActiveSync Connectivity" 
"`n"
$Status = "Yes"
Foreach ($db in $AS)
{Write-Host $DB.ClientAccessServerShortName – -NoNewline;
write-host " " -NoNewline;
Write-Host  $DB.Scenario = -NoNewline;
If ($DB.Result.value -ne "Success")
{ $Status = ‘No’
}

 

if ($status -eq "Yes")
{Write-host -Foregroundcolor $Yes " Yes"
}

else
{Write-Host -ForegroundColor $No " No"}
}
"`n"
"`n"
############################################################################

# Test OWA Connectivity to each Server

$OWA = Get-ClientAccessServer  |Test-OwaConnectivity

 
Write-Host "OWA Connectivity"
"`n"
$Status = "Yes"
Foreach ($db in $OWA)
{Write-Host $DB.ClientAccessServerShortName =  -NoNewline;
If ($DB.Result.Value -ne "Success")
{ $Status = ‘No’
}

 

if ($status -eq "Yes")
{Write-host -Foregroundcolor $Yes " Yes"
}

else
{Write-Host -ForegroundColor $No " No"}
}
"`n"
"`n"
############################################################################

# Test Mailflow on each Database

Write-Host "Mail flow "
"`n"
$Mbx = Get-MailboxDatabase

$Status = "Yes"
Foreach ($db in $MBX)
{Write-host $DB.name = -NoNewline;
$TF = Test-mailflow -Targetdatabase $db.name
if ($TF.testmailflowresult -ne "Success")
{$Status = "No"}

if ($status -eq "Yes")
{Write-host -Foregroundcolor $Yes " Yes"
}

else
{Write-Host -ForegroundColor $No " No"}
}
"`n"
"`n"
############################################################################

# Test CAS Ports

Write-Host "CAS Ports Open "
$Mbx = Get-ClientAccessServer

$Status = "Yes"
"`n"
Write-host "Port 80"
"`n"
Foreach ($db in $MBX)

{write-host $DB.name = -NoNewline;
$P= Test-Port -Computer $db.name -port 80 -tcp
if ( $P.open -ne "True")
{$Status = "No"}

if ($status -eq "Yes")
{Write-host -Foregroundcolor $Yes " Yes"
}

else
{Write-Host -ForegroundColor $No " No"}
}
"`n"
Write-host "Port 443"

Foreach ($db in $MBX)

{write-host $DB.name = -NoNewline;
$P= Test-Port -Computer $db.name -port 443 -tcp
if ( $P.open -ne "True")
{$Status = "No"}

if ($status -eq "Yes")
{Write-host -Foregroundcolor $Yes " Yes"
}

else
{Write-Host -ForegroundColor $No " No"}
}
"`n"

Write-host "Port 60001"

Foreach ($db in $MBX)

{write-host $DB.name = -NoNewline;
$P= Test-Port -Computer $db.name -port 60001 -tcp
if ( $P.open -ne "True")
{$Status = "No"}

if ($status -eq "Yes")
{Write-host -Foregroundcolor $Yes " Yes"
}

else
{Write-Host -ForegroundColor $No " No"}
}
"`n"

Write-host "Port 143"

Foreach ($db in $MBX)

{write-host $DB.name = -NoNewline;
$P= Test-Port -Computer $db.name -port 143 -tcp
if ( $P.open -ne "True")
{$Status = "No"}

if ($status -eq "Yes")
{Write-host -Foregroundcolor $Yes " Yes"
}

else
{Write-Host -ForegroundColor $No " No"}
}
"`n"

Write-host "Port 110"

Foreach ($db in $MBX)

{write-host $DB.name = -NoNewline;
$P= Test-Port -Computer $db.name -port 110 -tcp
if ( $P.open -ne "True")
{$Status = "No"}

if ($status -eq "Yes")
{Write-host -Foregroundcolor $Yes " Yes"
}

else
{Write-Host -ForegroundColor $No " No"}
}
"`n"
"`n"
############################################################################

# Test IMAP Connectivity to each Server

$IMAP = Get-ClientAccessServer |  Test-IMAPConnectivity
 
Write-Host "IMAP Connectivity " 
"`n"
$Status = "Yes"
Foreach ($db in $IMAP)
{write-host $DB.ClientAccessServerShortName = -NoNewline;
If ($DB.Result.value -ne "Success")
{ $Status = ‘No’
}

 

if ($status -eq "Yes")
{Write-host -Foregroundcolor $Yes " Yes"
}

else
{Write-Host -ForegroundColor $No " No"}
}
"`n"
"`n"

############################################################################

# Test POP3 Connectivity to each Server

$POP3 = Get-ClientAccessServer  |  Test-POPConnectivity
 
Write-Host "POP3 Connectivity  "
"`n"
$Status = "Yes"
Foreach ($db in $POP3)
{write-host $DB.ClientAccessServerShortName = -NoNewline;
If ($DB.Result.value -ne "Success")
{ $Status = ‘No’
}

 

if ($status -eq "Yes")
{Write-host -Foregroundcolor $Yes " Yes"
}

else
{Write-Host -ForegroundColor $No " No"}
}

"`n"
"`n"

Categories: Uncategorized Tags:

Basic Exchange 2010 Health Check PowerShell Script

March 30th, 2012 Daniel Davies Comments off

Please see below a handy PowerShell Script which will give you a quick health check on your environment

The PowerShell Script will check the following

  • That all Exchange Databases are Mounted
  • Mapi Connectivity to all databases are working
  • ActiveSync Connectivity to each CAS Server is working
  • OWA Connectivity to each CAS server is working
  • Mailflow to Each Database is working
  • Main CAS Server Ports are open and working
  • IMAP is working
  • POP3 is working
  • All Exchange Services are Started

Please note the test port function in the script is from the following http://gallery.technet.microsoft.com/scriptcenter/97119ed6-6fb2-446d-98d8-32d823867131

The Script will give an output like below

image

At a later date i will be blogging another PS1 script which will give a more verbose output.

Please save the below to a .PS1 file and run from the Exchange Management Shell.

######################Functions#################################################
function Test-Port{ 
<#   
.SYNOPSIS   
    Tests port on computer. 
   
.DESCRIPTION 
    Tests port on computer.
    
.PARAMETER computer 
    Name of server to test the port connection on.
     
.PARAMETER port 
    Port to test
      
.PARAMETER tcp 
    Use tcp port
     
.PARAMETER udp 
    Use udp port 
    
.PARAMETER UDPTimeOut
    Sets a timeout for UDP port query. (In milliseconds, Default is 1000) 
     
.PARAMETER TCPTimeOut
    Sets a timeout for TCP port query. (In milliseconds, Default is 1000) 
                 
    To Do: 
        Add capability to run background jobs for each host to shorten the time to scan.         
    
.EXAMPLE   
    Test-Port -computer ‘server’ -port 80 
    Checks port 80 on server ‘server’ to see if it is listening 
   
.EXAMPLE   
    ‘server’ | Test-Port -port 80 
    Checks port 80 on server ‘server’ to see if it is listening
     
.EXAMPLE   
    Test-Port -computer @(“server1″,”server2″) -port 80 
    Checks port 80 on server1 and server2 to see if it is listening 
   
.EXAMPLE
    Test-Port -comp dc1 -port 17 -udp -UDPtimeout 10000
   
    Server   : dc1
    Port     : 17
    TypePort : UDP
    Open     : True 
        
    Description
    ———–
    Queries port 17 (qotd) on the UDP port and returns whether port is open or not
      
.EXAMPLE   
    @(“server1″,”server2″) | Test-Port -port 80 
    Checks port 80 on server1 and server2 to see if it is listening 
     
.EXAMPLE   
    (Get-Content hosts.txt) | Test-Port -port 80 
    Checks port 80 on servers in host file to see if it is listening
    
.EXAMPLE   
    Test-Port -computer (Get-Content hosts.txt) -port 80 
    Checks port 80 on servers in host file to see if it is listening
       
.EXAMPLE   
    Test-Port -computer (Get-Content hosts.txt) -port @(1..59) 
    Checks a range of ports from 1-59 on all servers in the hosts.txt file     
           
#>  
[cmdletbinding( 
    DefaultParameterSetName = '', 
    ConfirmImpact = 'low' 
)] 
    Param( 
        [Parameter( 
            Mandatory = $True, 
            Position = 0, 
            ParameterSetName = '', 
            ValueFromPipeline = $True)] 
            [array]$computer, 
        [Parameter( 
            Position = 1, 
            Mandatory = $True, 
            ParameterSetName = '')] 
            [array]$port, 
        [Parameter( 
            Mandatory = $False, 
            ParameterSetName = '')] 
            [int]$TCPtimeout=1000, 
        [Parameter( 
            Mandatory = $False, 
            ParameterSetName = '')] 
            [int]$UDPtimeout=1000,            
        [Parameter( 
            Mandatory = $False, 
            ParameterSetName = '')] 
            [switch]$TCP, 
        [Parameter( 
            Mandatory = $False, 
            ParameterSetName = '')] 
            [switch]$UDP                                   
        ) 
    Begin { 
        If (!$tcp -AND !$udp) {$tcp = $True} 
        #Typically you never do this, but in this case I felt it was for the benefit of the function 
        #as any errors will be noted in the output of the report         
        $ErrorActionPreference = “SilentlyContinue” 
        $report = @() 
    } 
    Process {    
        ForEach ($c in $computer) { 
            ForEach ($p in $port) { 
                If ($tcp) {   
                    #Create temporary holder  
                    $temp = “” | Select Server, Port, TypePort, Open, Notes 
                    #Create object for connecting to port on computer 
                    $tcpobject = new-Object system.Net.Sockets.TcpClient 
                    #Connect to remote machine’s port               
                    $connect = $tcpobject.BeginConnect($c,$p,$null,$null) 
                    #Configure a timeout before quitting 
                    $wait = $connect.AsyncWaitHandle.WaitOne($TCPtimeout,$false) 
                    #If timeout 
                    If(!$wait) { 
                        #Close connection 
                        $tcpobject.Close() 
                        Write-Verbose “Connection Timeout” 
                        #Build report 
                        $temp.Server = $c 
                        $temp.Port = $p 
                        $temp.TypePort = “TCP” 
                        $temp.Open = “False” 
                        $temp.Notes = “Connection to Port Timed Out” 
                    } Else { 
                        $error.Clear() 
                        $tcpobject.EndConnect($connect) | out-Null 
                        #If error 
                        If($error[0]){ 
                            #Begin making error more readable in report 
                            [string]$string = ($error[0].exception).message 
                            $message = (($string.split(“:”)[1]).replace(‘”‘,”")).TrimStart() 
                            $failed = $true 
                        } 
                        #Close connection     
                        $tcpobject.Close() 
                        #If unable to query port to due failure 
                        If($failed){ 
                            #Build report 
                            $temp.Server = $c 
                            $temp.Port = $p 
                            $temp.TypePort = “TCP” 
                            $temp.Open = “False” 
                            $temp.Notes = “$message” 
                        } Else{ 
                            #Build report 
                            $temp.Server = $c 
                            $temp.Port = $p 
                            $temp.TypePort = “TCP” 
                            $temp.Open = “True”   
                            $temp.Notes = “” 
                        } 
                    }    
                    #Reset failed value 
                    $failed = $Null     
                    #Merge temp array with report             
                    $report += $temp 
                }     
                If ($udp) { 
                    #Create temporary holder  
                    $temp = “” | Select Server, Port, TypePort, Open, Notes                                    
                    #Create object for connecting to port on computer 
                    $udpobject = new-Object system.Net.Sockets.Udpclient
                    #Set a timeout on receiving message
                    $udpobject.client.ReceiveTimeout = $UDPTimeout
                    #Connect to remote machine’s port               
                    Write-Verbose “Making UDP connection to remote server”
                    $udpobject.Connect(“$c”,$p)
                    #Sends a message to the host to which you have connected.
                    Write-Verbose “Sending message to remote host”
                    $a = new-object system.text.asciiencoding
                    $byte = $a.GetBytes(“$(Get-Date)”)
                    [void]$udpobject.Send($byte,$byte.length)
                    #IPEndPoint object will allow us to read datagrams sent from any source. 
                    Write-Verbose “Creating remote endpoint”
                    $remoteendpoint = New-Object system.net.ipendpoint([system.net.ipaddress]::Any,0)
                    Try {
                        #Blocks until a message returns on this socket from a remote host.
                        Write-Verbose “Waiting for message return”
                        $receivebytes = $udpobject.Receive([ref]$remoteendpoint)
                        [string]$returndata = $a.GetString($receivebytes)
                        If ($returndata) {
                           Write-Verbose “Connection Successful” 
                            #Build report 
                            $temp.Server = $c 
                            $temp.Port = $p 
                            $temp.TypePort = “UDP” 
                            $temp.Open = “True” 
                            $temp.Notes = $returndata  
                            $udpobject.close()  
                        }                      
                    } Catch {
                        If ($Error[0].ToString() -match “bRespond after a period of timeb”) {
                            #Close connection 
                            $udpobject.Close() 
                            #Make sure that the host is online and not a false positive that it is open
                            If (Test-Connection -comp $c -count 1 -quiet) {
                                Write-Verbose “Connection Open” 
                                #Build report 
                                $temp.Server = $c 
                                $temp.Port = $p 
                                $temp.TypePort = “UDP” 
                                $temp.Open = “True” 
                                $temp.Notes = “”
                            } Else {
                                <#
                                It is possible that the host is not online or that the host is online, 
                                but ICMP is blocked by a firewall and this port is actually open.
                                #>
                                Write-Verbose “Host maybe unavailable” 
                                #Build report 
                                $temp.Server = $c 
                                $temp.Port = $p 
                                $temp.TypePort = “UDP” 
                                $temp.Open = “False” 
                                $temp.Notes = “Unable to verify if port is open or if host is unavailable.”                                
                            }                        
                        } ElseIf ($Error[0].ToString() -match “forcibly closed by the remote host” ) {
                            #Close connection 
                            $udpobject.Close() 
                            Write-Verbose “Connection Timeout” 
                            #Build report 
                            $temp.Server = $c 
                            $temp.Port = $p 
                            $temp.TypePort = “UDP” 
                            $temp.Open = “False” 
                            $temp.Notes = “Connection to Port Timed Out”                        
                        } Else {                     
                            $udpobject.close()
                        }
                    }    
                    #Merge temp array with report             
                    $report += $temp 
                }                                 
            } 
        }                 
    } 
    End { 
        #Generate Report 
        $report
    }
}

############################Variables########################################
$Yes = “Green”
$No = “Red”

#######################################Script################################
“`n”
Write-Host “Exchange Checks”
Write-Host “________________________________”
“`n”

# Check to make sure all databases are mounted

$MountedDB = get-mailboxdatabase -status
Write-Host “Databases Mounted = ” -NoNewline;

$Status = “Yes”
Foreach ($DB in $MountedDB)
{
If ($DB.Mounted -ne $true)
{ $Status = ‘No’
}
}

if ($status -eq “Yes”)
{Write-host -Foregroundcolor $Yes “Yes”
}

else
{Write-Host -ForegroundColor $No “No”}

############################################################################

# Test Mapi Connectivity to each Database

$MAPI = get-mailboxdatabase | Test-MapiConnectivity
Write-Host “Mapi Connectivity = ” -NoNewline;

$Status = “Yes”
Foreach ($db in $Mapi)
{
If ($DB.Result.value -ne “Success”)
{ $Status = ‘No’
}
}

if ($status -eq “Yes”)
{Write-host -Foregroundcolor $Yes “Yes”
}

else
{Write-Host -ForegroundColor $No “No”}

############################################################################

# Test ActiveSync Connectivity to each Server

$AS = Get-ClientAccessServer |  Test-ActiveSyncConnectivity
 
Write-Host “ActiveSync Connectivity = ” -NoNewline;

$Status = “Yes”
Foreach ($db in $AS)
{
If ($DB.Result.value -ne “Success”)
{ $Status = ‘No’
}
}

if ($status -eq “Yes”)
{Write-host -Foregroundcolor $Yes “Yes”
}

else
{Write-Host -ForegroundColor $No “No”}

############################################################################

# Test OWA Connectivity to each Server

$OWA = Get-ClientAccessServer  |Test-OwaConnectivity

 
Write-Host “OWA Connectivity = ” -NoNewline;

$Status = “Yes”
Foreach ($db in $OWA)
{
If ($DB.Result.Value -ne “Success”)
{ $Status = ‘No’
}
}

if ($status -eq “Yes”)
{Write-host -Foregroundcolor $Yes “Yes”
}

else
{Write-Host -ForegroundColor $No “No”}

############################################################################

# Test Mailflow on each Database

Write-Host “Mail flow = ” -NoNewline;
$Mbx = Get-MailboxDatabase

$Status = “Yes”
Foreach ($db in $MBX)
{ $TF = Test-mailflow -Targetdatabase $db.name
if ($TF.testmailflowresult -ne “Success”)
{$Status = “No”}
}

if ($status -eq “Yes”)
{Write-host -Foregroundcolor $Yes “Yes”
}

else
{Write-Host -ForegroundColor $No “No”}

############################################################################
# Test CAS Ports Connectivity

Write-Host “CAS Ports Open = ” -NoNewline;
$Mbx = Get-ClientAccessServer

$Status = “Yes”

Foreach ($db in $MBX)
{ $P= Test-Port -Computer $db.name -port 80 -tcp
if ( $P.open -ne “True”)
{$Status = “No”}
}

Foreach ($db in $MBX)
{ $P= Test-Port -Computer $db.name -port 60001 -tcp
if ( $P.open -ne “True”)
{$Status = “No”}
}

Foreach ($db in $MBX)
{ $P= Test-Port -Computer $db.name -port 443 -tcp
if ( $P.open -ne “True”)
{$Status = “No”}
}

Foreach ($db in $MBX)
{ $P= Test-Port -Computer $db.name -port 110 -tcp
if ( $P.open -ne “True”)
{$Status = “No”}
}

Foreach ($db in $MBX)
{ $P= Test-Port -Computer $db.name -port 143 -tcp
if ( $P.open -ne “True”)
{$Status = “No”}
}

if ($status -eq “Yes”)
{Write-host -Foregroundcolor $Yes “Yes”
}

else
{Write-Host -ForegroundColor $No “No”}

############################################################################

# Test IMAP Connectivity to each Server

$IMAP = Get-ClientAccessServer |  Test-ActiveSyncConnectivity
 
Write-Host “IMAP Connectivity = ” -NoNewline;

$Status = “Yes”
Foreach ($db in $IMAP)
{
If ($DB.Result.value -ne “Success”)
{ $Status = ‘No’
}
}

if ($status -eq “Yes”)
{Write-host -Foregroundcolor $Yes “Yes”
}

else
{Write-Host -ForegroundColor $No “No”}

############################################################################

# Test POP3 Connectivity to each Server

$POP3 = Get-ClientAccessServer |  Test-ActiveSyncConnectivity
 
Write-Host “POP3 Connectivity = ” -NoNewline;

$Status = “Yes”
Foreach ($db in $POP3)
{
If ($DB.Result.value -ne “Success”)
{ $Status = ‘No’
}
}

if ($status -eq “Yes”)
{Write-host -Foregroundcolor $Yes “Yes”
}

else
{Write-Host -ForegroundColor $No “No”}

############################################################################

# Test Services are Started

$SRV = Get-ClientAccessServer   |  Test-ServiceHealth
 
Write-Host “Services Started = ” -NoNewline;

$Status = “Yes”
Foreach ($db in $SRV)
{
If ($DB.RequiredServicesRunning -ne “True”)
{ $Status = ‘No’
}
}

if ($status -eq “Yes”)
{Write-host -Foregroundcolor $Yes “Yes”
}

else
{Write-Host -ForegroundColor $No “No”}
“`n”

Categories: Uncategorized Tags: