Skip to content

Commit 5b1f529

Browse files
committed
Fix up xComputer examples
1 parent cd943a8 commit 5b1f529

6 files changed

Lines changed: 51 additions & 109 deletions
Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
11
<#
22
.EXAMPLE
3-
This configuration will set a machine name and changes the
4-
workgroup it is in.
3+
This configuration will set the computer name to 'Server01'
4+
and make it part of 'ContosoWorkgroup' Workgroup.
55
#>
66
Configuration Example
77
{
88
param
99
(
1010
[Parameter()]
1111
[System.String[]]
12-
$NodeName = 'localhost',
13-
14-
[Parameter(Mandatory = $true)]
15-
[System.String]
16-
$MachineName,
17-
18-
[Parameter(Mandatory = $true)]
19-
[System.String]
20-
$WorkGroup
12+
$NodeName = 'localhost'
2113
)
2214

2315
Import-DscResource -Module xComputerManagement
@@ -26,8 +18,8 @@ Configuration Example
2618
{
2719
xComputer NewNameAndWorkgroup
2820
{
29-
Name = $MachineName
30-
WorkGroupName = $WorkGroup
21+
Name = 'Server01'
22+
WorkGroupName = 'ContosoWorkgroup'
3123
}
3224
}
3325
}

Examples/xComputer/2-JoinDomain.ps1

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<#
22
.EXAMPLE
3-
This configuration sets the machine name and joins a domain.
4-
Note: this requires a credential.
3+
This configuration sets the machine name to 'Server01' and
4+
joins the 'Contoso' domain.
5+
Note: this requires an AD credential to join the domain.
56
#>
67
Configuration Example
78
{
@@ -11,14 +12,6 @@ Configuration Example
1112
[System.String[]]
1213
$NodeName = 'localhost',
1314

14-
[Parameter(Mandatory = $true)]
15-
[System.String]
16-
$MachineName,
17-
18-
[Parameter(Mandatory = $true)]
19-
[System.String]
20-
$DomainName,
21-
2215
[Parameter(Mandatory = $true)]
2316
[ValidateNotNullorEmpty()]
2417
[System.Management.Automation.PSCredential]
@@ -31,8 +24,8 @@ Configuration Example
3124
{
3225
xComputer JoinDomain
3326
{
34-
Name = $MachineName
35-
DomainName = $DomainName
27+
Name = 'Server01'
28+
DomainName = 'Contoso'
3629
Credential = $Credential # Credential to join to domain
3730
}
3831
}

Examples/xComputer/3-RenameComputerInDomain.ps1

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<#
22
.EXAMPLE
3-
This example will change the machines name while remaining on the domain.
4-
Note: this requires a credential.
3+
This example will change the machines name 'Server01' while remaining
4+
joined to the current domain.
5+
Note: this requires a credential for renaming the machine on the
6+
domain.
57
#>
68
Configuration Example
79
{
@@ -11,10 +13,6 @@ Configuration Example
1113
[System.String[]]
1214
$NodeName = 'localhost',
1315

14-
[Parameter(Mandatory = $true)]
15-
[System.String]
16-
$MachineName,
17-
1816
[Parameter(Mandatory = $true)]
1917
[ValidateNotNullorEmpty()]
2018
[System.Management.Automation.PSCredential]
@@ -27,7 +25,7 @@ Configuration Example
2725
{
2826
xComputer NewName
2927
{
30-
Name = $MachineName
28+
Name = 'Server01'
3129
Credential = $Credential # Domain credential
3230
}
3331
}
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<#
22
.EXAMPLE
3-
This example will change the machines name while remaining
3+
This example will set the machine name to 'Server01' while remaining
44
in the workgroup.
55
#>
66
Configuration Example
@@ -9,11 +9,7 @@ Configuration Example
99
(
1010
[Parameter()]
1111
[System.String[]]
12-
$NodeName = 'localhost',
13-
14-
[Parameter(Mandatory = $true)]
15-
[System.String]
16-
$MachineName
12+
$NodeName = 'localhost'
1713
)
1814

1915
Import-DscResource -Module xComputerManagement
@@ -22,7 +18,7 @@ Configuration Example
2218
{
2319
xComputer NewName
2420
{
25-
Name = $MachineName
21+
Name = 'Server01'
2622
}
2723
}
2824
}

Examples/xComputer/5-UnjoinDomainAndJoinWorkgroup.ps1

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<#
22
.EXAMPLE
3-
This example switches the computer from a domain to a workgroup.
3+
This example switches the computer 'Server01' from a domain and joins it
4+
to the 'ContosoWorkgroup' Workgroup.
45
Note: this requires a credential.
56
#>
67
Configuration Example
@@ -11,14 +12,6 @@ Configuration Example
1112
[System.String[]]
1213
$NodeName = 'localhost',
1314

14-
[Parameter(Mandatory = $true)]
15-
[System.String]
16-
$MachineName,
17-
18-
[Parameter(Mandatory = $true)]
19-
[System.String]
20-
$WorkGroup,
21-
2215
[Parameter(Mandatory = $true)]
2316
[ValidateNotNullorEmpty()]
2417
[System.Management.Automation.PSCredential]
@@ -31,8 +24,8 @@ Configuration Example
3124
{
3225
xComputer JoinWorkgroup
3326
{
34-
Name = $MachineName
35-
WorkGroupName = $WorkGroup
27+
Name = 'Server01'
28+
WorkGroupName = 'ContosoWorkgroup'
3629
Credential = $Credential # Credential to unjoin from domain
3730
}
3831
}

README.md

Lines changed: 29 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,10 @@ xVirtualMemory has the following properties:
265265

266266
## Examples
267267

268-
### Change the Name and the Workgroup Name
268+
### Set the Name and the Workgroup Name
269269

270-
This configuration will set a machine name and changes the workgroup it is in.
270+
This configuration will set the computer name to 'Server01'
271+
and make it part of 'ContosoWorkgroup' Workgroup.
271272

272273
```powershell
273274
Configuration Example
@@ -276,15 +277,7 @@ Configuration Example
276277
(
277278
[Parameter()]
278279
[System.String[]]
279-
$NodeName = 'localhost',
280-
281-
[Parameter(Mandatory = $true)]
282-
[System.String]
283-
$MachineName,
284-
285-
[Parameter(Mandatory = $true)]
286-
[System.String]
287-
$WorkGroup
280+
$NodeName = 'localhost'
288281
)
289282
290283
Import-DscResource -Module xComputerManagement
@@ -293,17 +286,18 @@ Configuration Example
293286
{
294287
xComputer NewNameAndWorkgroup
295288
{
296-
Name = $MachineName
297-
WorkGroupName = $WorkGroup
289+
Name = 'Server01'
290+
WorkGroupName = 'ContosoWorkgroup'
298291
}
299292
}
300293
}
301294
```
302295

303296
### Switch from a Workgroup to a Domain
304297

305-
This configuration sets the machine name and joins a domain.
306-
Note: this requires a credential.
298+
This configuration sets the machine name to 'Server01' and
299+
joins the 'Contoso' domain.
300+
Note: this requires an AD credential to join the domain.
307301

308302
```powershell
309303
Configuration Example
@@ -314,14 +308,6 @@ Configuration Example
314308
[System.String[]]
315309
$NodeName = 'localhost',
316310
317-
[Parameter(Mandatory = $true)]
318-
[System.String]
319-
$MachineName,
320-
321-
[Parameter(Mandatory = $true)]
322-
[System.String]
323-
$DomainName,
324-
325311
[Parameter(Mandatory = $true)]
326312
[ValidateNotNullorEmpty()]
327313
[System.Management.Automation.PSCredential]
@@ -334,18 +320,20 @@ Configuration Example
334320
{
335321
xComputer JoinDomain
336322
{
337-
Name = $MachineName
338-
DomainName = $DomainName
323+
Name = 'Server01'
324+
DomainName = 'Contoso'
339325
Credential = $Credential # Credential to join to domain
340326
}
341327
}
342328
}
343329
```
344330

345-
### Change the Name while staying on the Domain
331+
### Set the Name while staying on the Domain
346332

347-
This example will change the machines name while remaining on the domain.
348-
Note: this requires a credential.
333+
This example will set the machines name 'Server01' while remaining
334+
joined to the current domain.
335+
Note: this requires a credential for renaming the machine on the
336+
domain.
349337

350338
```powershell
351339
Configuration Example
@@ -356,10 +344,6 @@ Configuration Example
356344
[System.String[]]
357345
$NodeName = 'localhost',
358346
359-
[Parameter(Mandatory = $true)]
360-
[System.String]
361-
$MachineName,
362-
363347
[Parameter(Mandatory = $true)]
364348
[ValidateNotNullorEmpty()]
365349
[System.Management.Automation.PSCredential]
@@ -372,16 +356,17 @@ Configuration Example
372356
{
373357
xComputer NewName
374358
{
375-
Name = $MachineName
359+
Name = 'Server01'
376360
Credential = $Credential # Domain credential
377361
}
378362
}
379363
}
380364
```
381365

382-
### Change the Name while staying on the Workgroup
366+
### Set the Name while staying on the Workgroup
383367

384-
This example will change the machines name while remaining in the workgroup.
368+
This example will set the machine name to 'Server01' while remaining
369+
in the workgroup.
385370

386371
```powershell
387372
Configuration Example
@@ -390,32 +375,25 @@ Configuration Example
390375
(
391376
[Parameter()]
392377
[System.String[]]
393-
$NodeName = 'localhost',
394-
395-
[Parameter(Mandatory = $true)]
396-
[ValidateNotNullorEmpty()]
397-
[System.Management.Automation.PSCredential]
398-
$Credential
378+
$NodeName = 'localhost'
399379
)
400380
401-
Import-DscResource -ModuleName xCertificate
381+
Import-DscResource -Module xComputerManagement
402382
403-
Node $AllNodes.NodeName
383+
Node $NodeName
404384
{
405-
xCertificateExport SSLCert
385+
xComputer NewName
406386
{
407-
Type = 'PFX'
408-
FriendlyName = 'Web Site SSL Certificate for www.contoso.com'
409-
Path = 'c:\sslcert.cer'
410-
Password = $Credential
387+
Name = 'Server01'
411388
}
412389
}
413390
}
414391
```
415392

416393
### Switch from a Domain to a Workgroup
417394

418-
This example switches the computer from a domain to a workgroup.
395+
This example switches the computer 'Server01' from a domain and joins it
396+
to the 'ContosoWorkgroup' Workgroup.
419397
Note: this requires a credential.
420398

421399
```powershell
@@ -427,14 +405,6 @@ Configuration Example
427405
[System.String[]]
428406
$NodeName = 'localhost',
429407
430-
[Parameter(Mandatory = $true)]
431-
[System.String]
432-
$MachineName,
433-
434-
[Parameter(Mandatory = $true)]
435-
[System.String]
436-
$WorkGroup,
437-
438408
[Parameter(Mandatory = $true)]
439409
[ValidateNotNullorEmpty()]
440410
[System.Management.Automation.PSCredential]
@@ -447,8 +417,8 @@ Configuration Example
447417
{
448418
xComputer JoinWorkgroup
449419
{
450-
Name = $MachineName
451-
WorkGroupName = $WorkGroup
420+
Name = 'Server01'
421+
WorkGroupName = 'ContosoWorkgroup'
452422
Credential = $Credential # Credential to unjoin from domain
453423
}
454424
}

0 commit comments

Comments
 (0)