Tuesday, 17 September 2013

PowerShell to Enable and Configure Database Mail across various SQL servers

Recently I was asked to configure Database Mail on all SQL Servers in one of my client environment, Instead of using SSMS or TSQL I tried to use PowerShell with SMO objects to accomplish the task faster, Find the script below I created for the same, I took reference from http://www.sqlservercentral.com/articles/Database+Mail/74429/ and created my version of script, The Script can be run for one server or set of SQL Servers listed in a file. By default the Account and Profile name will be ServerName or SQLName_InstanceName in case of named instance which you can change by just assigning right  value to the variables in the bleow script.
Copyright © 2013 Vinoth N Manoharan.The information provided in this post is provided "as is" with no implied warranties or guarantees.


  1. This comment has been removed by the author.

  2. That's a great script sir! Just what I was looking for. Thank you.

  3. This script is very useful. I'm curious, is there any option to change the current name of the account which associated with Profile by using PowerShell script?