Examples/Resources/xSQLServerLogin/2-RemoveLogin.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
<#
.EXAMPLE
This example shows how to remove the Windows user 'CONTOSO\WindowsUser'.
 
.EXAMPLE
This example shows how to remove Windows group 'CONTOSO\WindowsGroup'.
 
.EXAMPLE
This example shows how to remove the SQL Login 'SqlLogin'.
#>


Configuration Example
{
    Import-DscResource -ModuleName xSqlServer

    node localhost {
        xSQLServerLogin Remove_WindowsUser
        {
            Ensure          = 'Absent'
            Name            = 'CONTOSO\WindowsUser'
            LoginType       = 'WindowsUser'
            SQLServer       = 'SQLServer'
            SQLInstanceName = 'DSC'
        }

        xSQLServerLogin Remove_WindowsGroup
        {
            Ensure          = 'Absent'
            Name            = 'CONTOSO\WindowsGroup'
            LoginType       = 'WindowsGroup'
            SQLServer       = 'SQLServer'
            SQLInstanceName = 'DSC'
        }

        xSQLServerLogin Remove_SqlLogin
        {
            Ensure          = 'Absent'
            Name            = 'SqlLogin'
            LoginType       = 'SqlLogin'
            SQLServer       = 'SQLServer'
            SQLInstanceName = 'DSC'
        }
    }
}