Skip to content

Commit cd943a8

Browse files
committed
Change examples to meet HQRM standards and optin to Example validation tests.
1 parent 731f23c commit cd943a8

14 files changed

Lines changed: 410 additions & 216 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.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<#
2+
.EXAMPLE
3+
This configuration will set a machine name and changes the
4+
workgroup it is in.
5+
#>
6+
Configuration Example
7+
{
8+
param
9+
(
10+
[Parameter()]
11+
[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
21+
)
22+
23+
Import-DscResource -Module xComputerManagement
24+
25+
Node $NodeName
26+
{
27+
xComputer NewNameAndWorkgroup
28+
{
29+
Name = $MachineName
30+
WorkGroupName = $WorkGroup
31+
}
32+
}
33+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<#
2+
.EXAMPLE
3+
This configuration sets the machine name and joins a domain.
4+
Note: this requires a credential.
5+
#>
6+
Configuration Example
7+
{
8+
param
9+
(
10+
[Parameter()]
11+
[System.String[]]
12+
$NodeName = 'localhost',
13+
14+
[Parameter(Mandatory = $true)]
15+
[System.String]
16+
$MachineName,
17+
18+
[Parameter(Mandatory = $true)]
19+
[System.String]
20+
$DomainName,
21+
22+
[Parameter(Mandatory = $true)]
23+
[ValidateNotNullorEmpty()]
24+
[System.Management.Automation.PSCredential]
25+
$Credential
26+
)
27+
28+
Import-DscResource -Module xComputerManagement
29+
30+
Node $NodeName
31+
{
32+
xComputer JoinDomain
33+
{
34+
Name = $MachineName
35+
DomainName = $DomainName
36+
Credential = $Credential # Credential to join to domain
37+
}
38+
}
39+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<#
2+
.EXAMPLE
3+
This example will change the machines name while remaining on the domain.
4+
Note: this requires a credential.
5+
#>
6+
Configuration Example
7+
{
8+
param
9+
(
10+
[Parameter()]
11+
[System.String[]]
12+
$NodeName = 'localhost',
13+
14+
[Parameter(Mandatory = $true)]
15+
[System.String]
16+
$MachineName,
17+
18+
[Parameter(Mandatory = $true)]
19+
[ValidateNotNullorEmpty()]
20+
[System.Management.Automation.PSCredential]
21+
$Credential
22+
)
23+
24+
Import-DscResource -Module xComputerManagement
25+
26+
Node $NodeName
27+
{
28+
xComputer NewName
29+
{
30+
Name = $MachineName
31+
Credential = $Credential # Domain credential
32+
}
33+
}
34+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<#
2+
.EXAMPLE
3+
This example will change the machines name while remaining
4+
in the workgroup.
5+
#>
6+
Configuration Example
7+
{
8+
param
9+
(
10+
[Parameter()]
11+
[System.String[]]
12+
$NodeName = 'localhost',
13+
14+
[Parameter(Mandatory = $true)]
15+
[System.String]
16+
$MachineName
17+
)
18+
19+
Import-DscResource -Module xComputerManagement
20+
21+
Node $NodeName
22+
{
23+
xComputer NewName
24+
{
25+
Name = $MachineName
26+
}
27+
}
28+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<#
2+
.EXAMPLE
3+
This example switches the computer from a domain to a workgroup.
4+
Note: this requires a credential.
5+
#>
6+
Configuration Example
7+
{
8+
param
9+
(
10+
[Parameter()]
11+
[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,
21+
22+
[Parameter(Mandatory = $true)]
23+
[ValidateNotNullorEmpty()]
24+
[System.Management.Automation.PSCredential]
25+
$Credential
26+
)
27+
28+
Import-DscResource -Module xComputerManagement
29+
30+
Node $NodeName
31+
{
32+
xComputer JoinWorkgroup
33+
{
34+
Name = $MachineName
35+
WorkGroupName = $WorkGroup
36+
Credential = $Credential # Credential to unjoin from domain
37+
}
38+
}
39+
}
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+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<#
2+
.EXAMPLE
3+
This examples sets the active power plan to the 'High performance' plan.
4+
#>
5+
Configuration Example
6+
{
7+
param
8+
(
9+
[Parameter()]
10+
[System.String[]]
11+
$NodeName = 'localhost'
12+
)
13+
14+
Import-DscResource -ModuleName xComputerManagement
15+
16+
Node $NodeName
17+
{
18+
xPowerPlan SetPlanHighPerformance
19+
{
20+
IsSingleInstance = 'Yes'
21+
Name = 'High performance'
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)