DSCResources/DSC_Computer/en-US/about_Computer.help.txt

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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
.NAME
    Computer
 
.DESCRIPTION
    The resource allows you to configure a computer by changing its name and
    description and modifying its Active Directory domain or workgroup membership.
 
.PARAMETER Name
    Key - String
    The desired computer name.
 
.PARAMETER DomainName
    Write - String
    The name of the domain to join.
 
.PARAMETER JoinOU
    Write - String
    The distinguished name of the organizational unit that the computer account will be created in.
 
.PARAMETER Credential
    Write - Instance
    Credential to be used to join a domain.
 
.PARAMETER UnjoinCredential
    Write - Instance
    Credential to be used to leave a domain.
 
.PARAMETER WorkGroupName
    Write - String
    The name of the workgroup.
 
.PARAMETER Description
    Write - String
    The value assigned here will be set as the local computer description.
 
.PARAMETER Server
    Write - String
    The Active Directory Domain Controller to use to join the domain
 
.PARAMETER CurrentOU
    Read - String
    A read-only property that specifies the organizational unit that the computer account is currently in.
 
.EXAMPLE 1
 
This configuration will set the computer name to 'Server01'
and make it part of 'ContosoWorkgroup' Workgroup.
 
Configuration Computer_RenameComputerAndSetWorkgroup_Config
{
    Import-DscResource -Module ComputerManagementDsc
 
    Node localhost
    {
        Computer NewNameAndWorkgroup
        {
            Name = 'Server01'
            WorkGroupName = 'ContosoWorkgroup'
        }
    }
}
 
.EXAMPLE 2
 
This configuration sets the machine name to 'Server01' and
joins the 'Contoso' domain.
Note: this requires an AD credential to join the domain.
 
Configuration Computer_JoinDomain_Config
{
    param
    (
        [Parameter(Mandatory = $true)]
        [ValidateNotNullorEmpty()]
        [System.Management.Automation.PSCredential]
        $Credential
    )
 
    Import-DscResource -Module ComputerManagementDsc
 
    Node localhost
    {
        Computer JoinDomain
        {
            Name = 'Server01'
            DomainName = 'Contoso'
            Credential = $Credential # Credential to join to domain
        }
    }
}
 
.EXAMPLE 3
 
This example will change the machines name 'Server01' while remaining
joined to the current domain.
Note: this requires a credential for renaming the machine on the
domain.
 
Configuration Computer_RenameComputerInDomain_Config
{
    param
    (
        [Parameter(Mandatory = $true)]
        [ValidateNotNullorEmpty()]
        [System.Management.Automation.PSCredential]
        $Credential
    )
 
    Import-DscResource -Module ComputerManagementDsc
 
    Node localhost
    {
        Computer NewName
        {
            Name = 'Server01'
            Credential = $Credential # Domain credential
        }
    }
}
 
.EXAMPLE 4
 
This example will set the machine name to 'Server01' while remaining
in the workgroup.
 
Configuration Computer_RenameComputerInWorkgroup_Config
{
    Import-DscResource -Module ComputerManagementDsc
 
    Node localhost
    {
        Computer NewName
        {
            Name = 'Server01'
        }
    }
}
 
.EXAMPLE 5
 
This example switches the computer 'Server01' from a domain and joins it
to the 'ContosoWorkgroup' Workgroup.
Note: this requires a credential.
 
Configuration Computer_UnjoinDomainAndJoinWorkgroup_Config
{
    param
    (
        [Parameter(Mandatory = $true)]
        [ValidateNotNullorEmpty()]
        [System.Management.Automation.PSCredential]
        $Credential
    )
 
    Import-DscResource -Module ComputerManagementDsc
 
    Node localhost
    {
        Computer JoinWorkgroup
        {
            Name = 'Server01'
            WorkGroupName = 'ContosoWorkgroup'
            Credential = $Credential # Credential to unjoin from domain
        }
    }
}
 
.EXAMPLE 6
 
This example will set the computer description.
 
Configuration Computer_SetComputerDescriptionInWorkgroup_Config
{
    Import-DscResource -Module ComputerManagementDsc
 
    Node localhost
    {
        Computer NewDescription
        {
            Name = 'localhost'
            Description = 'This is my computer.'
        }
    }
}
 
.EXAMPLE 7
 
This configuration sets the machine name to 'Server01' and
joins the 'Contoso' domain using the domain controller 'dc1.contoso.com'.
Note: this requires an AD credential to join the domain.
 
Configuration Computer_JoinDomainSpecifyingDC_Config
{
    param
    (
        [Parameter(Mandatory = $true)]
        [ValidateNotNullorEmpty()]
        [System.Management.Automation.PSCredential]
        $Credential
    )
 
    Import-DscResource -Module ComputerManagementDsc
 
    Node localhost
    {
        Computer JoinDomain
        {
            Name = 'Server01'
            DomainName = 'Contoso'
            Credential = $Credential # Credential to join to domain
            Server = 'dc1.contoso.com'
        }
    }
}