Skip to content

Commit 1bbbf03

Browse files
authored
Merge pull request #86 from PlagueHO/Issue-82
Correct Example Style to meet HQRM and Enable Example Tests - Fixes #82
2 parents 731f23c + ec15195 commit 1bbbf03

15 files changed

Lines changed: 301 additions & 392 deletions

.MetaTestOptIn.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[
2-
"Common Tests - Validate Markdown Files"
2+
"Common Tests - Validate Markdown Files",
3+
"Common Tests - Validate Example Files"
34
]

Examples/Sample_xOfflineDomainJoin.ps1

Lines changed: 0 additions & 21 deletions
This file was deleted.

Examples/Sample_xPowerPlan.ps1

Lines changed: 0 additions & 30 deletions
This file was deleted.

Examples/Sample_xVirtualMemory.ps1

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<#
2+
.EXAMPLE
3+
This configuration will set the computer name to 'Server01'
4+
and make it part of 'ContosoWorkgroup' Workgroup.
5+
#>
6+
Configuration Example
7+
{
8+
param
9+
(
10+
[Parameter()]
11+
[System.String[]]
12+
$NodeName = 'localhost'
13+
)
14+
15+
Import-DscResource -Module xComputerManagement
16+
17+
Node $NodeName
18+
{
19+
xComputer NewNameAndWorkgroup
20+
{
21+
Name = 'Server01'
22+
WorkGroupName = 'ContosoWorkgroup'
23+
}
24+
}
25+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<#
2+
.EXAMPLE
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.
6+
#>
7+
Configuration Example
8+
{
9+
param
10+
(
11+
[Parameter()]
12+
[System.String[]]
13+
$NodeName = 'localhost',
14+
15+
[Parameter(Mandatory = $true)]
16+
[ValidateNotNullorEmpty()]
17+
[System.Management.Automation.PSCredential]
18+
$Credential
19+
)
20+
21+
Import-DscResource -Module xComputerManagement
22+
23+
Node $NodeName
24+
{
25+
xComputer JoinDomain
26+
{
27+
Name = 'Server01'
28+
DomainName = 'Contoso'
29+
Credential = $Credential # Credential to join to domain
30+
}
31+
}
32+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<#
2+
.EXAMPLE
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.
7+
#>
8+
Configuration Example
9+
{
10+
param
11+
(
12+
[Parameter()]
13+
[System.String[]]
14+
$NodeName = 'localhost',
15+
16+
[Parameter(Mandatory = $true)]
17+
[ValidateNotNullorEmpty()]
18+
[System.Management.Automation.PSCredential]
19+
$Credential
20+
)
21+
22+
Import-DscResource -Module xComputerManagement
23+
24+
Node $NodeName
25+
{
26+
xComputer NewName
27+
{
28+
Name = 'Server01'
29+
Credential = $Credential # Domain credential
30+
}
31+
}
32+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<#
2+
.EXAMPLE
3+
This example will set the machine name to 'Server01' while remaining
4+
in the workgroup.
5+
#>
6+
Configuration Example
7+
{
8+
param
9+
(
10+
[Parameter()]
11+
[System.String[]]
12+
$NodeName = 'localhost'
13+
)
14+
15+
Import-DscResource -Module xComputerManagement
16+
17+
Node $NodeName
18+
{
19+
xComputer NewName
20+
{
21+
Name = 'Server01'
22+
}
23+
}
24+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<#
2+
.EXAMPLE
3+
This example switches the computer 'Server01' from a domain and joins it
4+
to the 'ContosoWorkgroup' Workgroup.
5+
Note: this requires a credential.
6+
#>
7+
Configuration Example
8+
{
9+
param
10+
(
11+
[Parameter()]
12+
[System.String[]]
13+
$NodeName = 'localhost',
14+
15+
[Parameter(Mandatory = $true)]
16+
[ValidateNotNullorEmpty()]
17+
[System.Management.Automation.PSCredential]
18+
$Credential
19+
)
20+
21+
Import-DscResource -Module xComputerManagement
22+
23+
Node $NodeName
24+
{
25+
xComputer JoinWorkgroup
26+
{
27+
Name = 'Server01'
28+
WorkGroupName = 'ContosoWorkgroup'
29+
Credential = $Credential # Credential to unjoin from domain
30+
}
31+
}
32+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<#
2+
.EXAMPLE
3+
This example will join the computer to a domain using the ODJ
4+
request file C:\ODJ\ODJRequest.txt.
5+
#>
6+
Configuration Example
7+
{
8+
param
9+
(
10+
[Parameter()]
11+
[System.String[]]
12+
$NodeName = 'localhost'
13+
)
14+
15+
Import-DscResource -ModuleName xComputerManagement
16+
17+
Node $NodeName
18+
{
19+
xOfflineDomainJoin ODJ
20+
{
21+
IsSingleInstance = 'Yes'
22+
RequestFile = 'C:\ODJ\ODJBlob.txt'
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)