forked from dsccommunity/SqlServerDsc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
1-EnableDatabaseMail.ps1
50 lines (43 loc) · 1.43 KB
/
1-EnableDatabaseMail.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<#
.DESCRIPTION
This example will enable Database Mail on a SQL Server instance and
create a mail account with a default public profile.
#>
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.PSCredential]
$SqlInstallCredential
)
Import-DscResource -ModuleName 'SqlServerDsc'
node localhost
{
SqlConfiguration 'EnableDatabaseMailXPs'
{
ServerName = $Node.NodeName
InstanceName = 'DSCSQLTEST'
OptionName = 'Database Mail XPs'
OptionValue = 1
RestartService = $false
}
SqlDatabaseMail 'EnableDatabaseMail'
{
Ensure = 'Present'
ServerName = $Node.NodeName
InstanceName = 'DSCSQLTEST'
AccountName = 'MyMail'
ProfileName = 'MyMailProfile'
EmailAddress = '[email protected]'
ReplyToAddress = '[email protected]'
DisplayName = 'mail.company.local'
MailServerName = 'mail.company.local'
Description = 'Default mail account and profile.'
LoggingLevel = 'Normal'
TcpPort = 25
PsDscRunAsCredential = $SqlInstallCredential
}
}
}