dMb Online

BBQ Lover, Real Ale Monster, Snowboarder, Technical Architect.

  • About Me
  • Contact

Microsoft

SQL 2016 configuring database mail on Windows 2016

02/03/2017 / Leave a Comment

Recently I’ve started using SQL 2016 with basic availability groups for a new Citrix deployment. Whilst going through the configuration of my maintenance plans I thought it would be sensible to setup email notifications. I went through the following process of setting up database mail however I stumbled across an issue where the emails weren’t being sent.

To configure Database Mail open up the SQL management studio and right click Database Mail and select Configure Database Mail:

Configure SQL Database Mail

We will follow through the wizard to complete the basic configuration:

Start the Database Mail Configuration Wizard

Select set up Database Mail by performing the following tasks:

If the Database Mail feature is not available you will be asked to enable the feature, select Yes:

Create a new profile by populating the fields with meaningful information, then add an SMTP account:

Enter the relevant email settings for your server, this could be a local SMTP which allows relay, an Exchange server or even a Gmail account:

Select next:

Select the public checkbox next to the profile you have created:

Select next:

Select finish:

If everything goes to plan you will have no errors on this next bit, you can then select close:

Right click Database Mail and select send test e-mail:

SQL send Test E-Mail...

Enter the email address you would like to send the test email to and select send test e-mail:

Wait a short while to see if you receive the message, I waited 60 seconds before I thought something wasn’t right:

After clicking OK nothing happened, my first line of troubleshooting was connecting to the Exchange server with Telnet. I was able to confirm I could send an email by entering in the commands manually. There were no logs under Database Mail on the SQL server, so I proceeded to check the Database Mail queues.

Create a new query and enter the following for SQL 2016:

SELECT * FROM msdb..sysmail_event_log order by log_id DESC
SELECT * FROM msdb.dbo.sysmail_mailitems
SELECT * FROM msdb.dbo.sysmail_sentitems
USE msdb
SELECT sent_status, *
FROM sysmail_allitems
SELECT is_broker_enabled FROM sys.databases WHERE name = 'msdb';
EXECUTE msdb.dbo.sysmail_help_status_sp

You can see that the sent_status of the mail is unsent.

Open Windows Explorer and navigate to the following location:

When double clicking on DatabaseMail.exe I received the following message stating the following feature couldn’t be installed. Clear there is a requirement for .NET Framework 3.5 (includes .NET 2.0 and 3.0):

Open PowerShell, make sure you run it as administrator otherwise you will receive the following error:

With Windows 2016 you will need to specify an additional source such as a DVD or ISO, enter the following command:

DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:D:\sources\sxs

You will need to make sure you mount the ISO or insert the Windows 2016 DVD and select the correct path:

DISM installation in progress

Installation completed:

DISM installation completed

If you attempt to open DatabaseMail.exe now it will send the items in the queue.

I hope this helps and saves some head scratching!

Posted in: Geeky Stuff, Microsoft, SQL Tagged: Database Mail, SQL 2016

Exchange Powershell

18/10/2013 / Leave a Comment

In recent months both myself and powershell are becoming best buds. I love the way how it makes my life so much easier. I’ve been asked by plenty of customers for a comprehensive list of mailboxes on their IT systems, you can find out by entering the following powershell command on Microsoft Exchange 2007, 2010 and 2013 servers:

get-mailbox –resultsize unlimited | get-mailboxstatistics | select-object DisplayName,TotalItemSize,LastLogonTime | Sort-Object DisplayName

The above command will display a list of mailboxes sorted by the DisplayName field, the size of mailbox and when they last logged on.

If you would like to output this to a text file to send to someone you can use:

get-mailbox –resultsize unlimited | get-mailboxstatistics | select-object DisplayName,TotalItemSize,LastLogonTime | Sort-Object DisplayName > C:\list-of-mailboxes.txt

Enjoy

Posted in: Microsoft Tagged: Exchange, Exchange 2007, Exchange 2010, Exchange 2013, List Of Mailboxes, Mailbox, Microsoft, Powershell

World Wide Web Publishing Service failed to start

12/03/2013 / Leave a Comment

I woke up this morning to find one of my customers Sharepoint sites wasn’t running, after logging on to the server I discovered a number of service errors.

System event log 7001

wpid309-media_1363077531197.png

The World Wide Web Publishing Service service depends on the Windows Process Activation Service service which failed to start because of the following error:
Transaction support within the specified resource manager is not started or was shut down due to an error.

System event log 5189

wpid310-media_1363077663453.png

The Windows Process Activation Service failed to generate an application pool config file for application pool ‘*’. The error type is ‘0’. To resolve this issue, please ensure that the applicationhost.config file is correct and recommit the last configuration changes made. The data field contains the error number.

First thoughts

Initially I ran a chkdsk on the system drive, but the file system was clean. I then ran the following command from an elevated command prompt:

fsutil resource setautoreset true c:\

The above command assume c:\ is the system drive. When you issue this command the transactional resource manager will clean the transaction metadata on its next mount on drive c:\.

Afterwards I restarted the server, and it restarted with a clean bill of health.

Final thoughts

All this was achieved with proactive monitoring and before 08:30am so the customer didn’t even know anything was wrong.

Posted in: Geeky Stuff, Microsoft Tagged: 5189, 7001, IIS, Service, System log, Windows 2008, World Wide Web Publishing
1 2 Next »

Buy Me a Coffee

Copyright © 2025 dMb Online.

Me WordPress Theme by themehall.com

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok