forked from dsccommunity/SqlServerDsc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1-SetDatabaseRecoveryModel.ps1
60 lines (50 loc) · 1.75 KB
/
1-SetDatabaseRecoveryModel.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
50
51
52
53
54
55
56
57
58
59
60
<#
.DESCRIPTION
This example shows how to set the Recovery Model
to "Full" for SQL database "AdventureWorks".
#>
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$SqlAdministratorCredential
)
Import-DscResource -ModuleName 'SqlServerDsc'
node localhost
{
SqlDatabase 'Add_SqlDatabaseAdventureworks'
{
Ensure = 'Present'
Name = 'Adventureworks'
ServerName = 'sqltest.company.local'
InstanceName = 'DSC'
PsDscRunAsCredential = $SqlAdministratorCredential
}
SqlDatabase 'Add_SqlDatabaseAdventureWorks2012'
{
Ensure = 'Present'
Name = 'AdventureWorks2012'
ServerName = 'sqltest.company.local'
InstanceName = 'DSC'
PsDscRunAsCredential = $SqlAdministratorCredential
}
SqlDatabaseRecoveryModel 'Set_SqlDatabaseRecoveryModel_Adventureworks'
{
Name = 'Adventureworks'
RecoveryModel = 'Full'
ServerName = 'sqltest.company.local'
InstanceName = 'DSC'
PsDscRunAsCredential = $SqlAdministratorCredential
}
SqlDatabaseRecoveryModel 'Set_SqlDatabaseRecoveryModel_AdventureWorks2012'
{
Name = 'AdventureWorks2012'
RecoveryModel = 'Simple'
ServerName = 'sqltest.company.local'
InstanceName = 'DSC'
PsDscRunAsCredential = $SqlAdministratorCredential
}
}
}