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.

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:

Forcing a Child Site Resync – SCCM 2007, site not found

March 29th, 2012 steveh Comments off

Hi there,

I came across an issue recently with a child primary site that had failed to replicate a number of resources from it’s parent site.

After working through some of these issues, and rectifying the replication I needed to perform a full child resync.

This is simple to do by running the following command;

  • Preinst.exe /CHILDSYNC <SiteCode>   ~ from the parent site

However an error was returned straight away stating that;

  • Cannot connect to SQL Database
  • <SiteCode> is not a known site

It turned out that this was because the account that I was using to run this did not have Site Modify permissions on the Parent Site. These permissions also need to be assigned directly to the account (not via a Security Group)

Once this was done, I re-run the command and a resync occurred.

Thanks,
Steve

Categories: Uncategorized Tags: , ,

CRM 2011 Rollup 7 Released

March 22nd, 2012 Daniel Davies Comments off

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

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

Categories: Uncategorized Tags:

Windows Live Essential 2011

March 21st, 2012 Daniel Davies Comments off

Windows Live Essentials 2011 has been released and is now available for download from the Microsoft Download Center . You can download via the following link http://www.microsoft.com/download/en/details.aspx?id=29219&WT.mc_id=rss_alldownloads_all Smile

Categories: Uncategorized Tags:

Windows 8 Keyboard Shortcuts

March 19th, 2012 Jovan Davis Comments off

After installing the Windows 8 Consumer Preview, I have found myself frequently switching between the Metro and Desktop App. The following keyboard guide is useful as it lists all of the shortcuts:

Keyboard Guide

I find myself frequently using Windows Key + I to power off my machine and Windows Key + Q to search for Apps.

Smile

Categories: Uncategorized Tags:

Server 8 Hyper-V and Vyatta

March 18th, 2012 steveh Comments off

Hi there,

Whilst re-building my lab on Server 8 Beta I came across an issue with running Vyatta which I use as a software router/firewall.

I attached the network cards as synthetic NICs and upon boot received the following error;

Spurious ACK on isa0060/serio0. Some program migh be trying to access hardware directly.

This error hangs the machine and you have to end the task to regain control.

After attempting to turn off all the advanced features of the card, e.g. SR-IOV and VMQ I was still having no luck. As a final attempt I selected the NIC and disconnected it from a vSwitch leaving it ‘Not Connected’, and booted the machine. It worked! I then reconnected the network once the router had booted and I could configure and routing worked as usual :)

This is only suitable in a LAB environment and would not be a solution if you were attempting to use this in production as if for any reason the router rebooted it would hang on reload. Additionally, I have not done anything in the way of performance testing as I assume the reason for the initial error is driver related.

Thanks,
SteveH

CRM 2011 Issue on Windows 8

March 16th, 2012 Daniel Davies Comments off

We’ve had a few issues recent in regards to the CRM 2011 Outlook add-in on Windows 8.

The issues manifested there selves in a two different ways.

  1. First being that we couldn’t install the CRM client due to the Installation of Windows Identity Foundation failing
  2. CRM Client installed but we were getting connection errors even after typing the correct CRM URL.

We resolved this by adding the “Windows Identity Foundation 3.5”  and all started working.

image

Categories: Uncategorized Tags:

How to view your DNS Cache

March 16th, 2012 Daniel Davies Comments off

Here’s quite a useful command that will come in handy while troubleshooting name resolution issues. The below command will show you all the entries in your DNS cache and will help you identify if it needs to be cleared as it may be holding an old IP address for a certain hostname.

ipconfig /displaydns

Categories: Uncategorized Tags:

PowerShell Command to View the Amount of White Space in your Exchange Databases

March 15th, 2012 Daniel Davies Comments off

Just a quick useful command to show the amount of white space in your Exchange Database

Get-MailboxDatabase -Status | Select-Object Server,Name,AvailableNewMailboxSpace

The command issues an output like below

image

Categories: Uncategorized Tags:

Microsoft SQL Server 2012 Evaluation Released

March 7th, 2012 Daniel Davies Comments off

Microsoft SQL Server 2012 Evaluation has now been released!

You can download it from the following location http://www.microsoft.com/download/en/details.aspx?id=29066

“Microsoft SQL Server 2012 enables a cloud-ready information platform that will help organizations unlock breakthrough insights across the organization as well as quickly build solutions and extend data across on-premises and public cloud backed by capabilities for mission critical confidence.
SQL Server 2012 enables a cloud-ready information platform that will help organizations unlock breakthrough insights across the organization as well as quickly build solutions and extend data across on-premises and public cloud backed by capabilities for mission critical confidence:

  • Deliver required uptime and data protection with AlwaysOn
  • Gain breakthrough & predictable performance with ColumnStore Index
  • Help enable security and compliance with new User-defined Roles and Default Schema for Groups
  • Enable rapid data discovery for deeper insights across the organization with ColumnStore Index
  • Ensure more credible, consistent data with SSIS improvements, a Master Data Services add-in for Excel, and new Data Quality Services
  • Optimize IT and developer productivity across server and cloud with Data-tier Application Component (DAC) parity with SQL Azure and SQL Server Data Tools for a unified dev experience across database, BI, and cloud functions”
Categories: Uncategorized Tags: