Skip to content
This repository was archived by the owner on Jun 14, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
550f300
Fix Example Configuration Names
X-Guardian Apr 30, 2019
9b36261
Add MetaTestOptIn file
X-Guardian Apr 30, 2019
51d75eb
Sample_User_CreateUser changes:
X-Guardian May 1, 2019
120d661
Sample_WindowsPackageCab changes for example tests
X-Guardian May 1, 2019
9f7069a
Sample_WindowsOptionalFeature Changes
X-Guardian May 1, 2019
7d7858b
Fix Pester 'Multiple Script Modules' error
X-Guardian May 4, 2019
a172c38
Add resourceSetHelpName var
X-Guardian May 4, 2019
ec12d5c
Fix resourceSetHelpName var
X-Guardian May 4, 2019
1c4bd93
Force integration test re-run
X-Guardian May 4, 2019
fd81a23
resourceSetHelpFilePath fix
X-Guardian May 4, 2019
8924be9
Test: Disable import-module ResourceSetHelper
X-Guardian May 4, 2019
97e5be7
Merge branch 'dev' into Example-Fix
X-Guardian May 24, 2019
e75b2ff
Merge branch 'dev' of https://github.com/X-Guardian/PSDscResources in…
X-Guardian May 24, 2019
4d521ad
Merge branch 'dev' into Example-Fix
X-Guardian Jun 3, 2019
31332df
Merge Dev (#1)
X-Guardian Jun 3, 2019
716946e
Merge from Dev
X-Guardian Jun 3, 2019
eeddbba
Fix Example Configuration Names
X-Guardian Apr 30, 2019
380cdb8
Add MetaTestOptIn file
X-Guardian Apr 30, 2019
8e6abcb
Sample_User_CreateUser changes:
X-Guardian May 1, 2019
a1712d1
Sample_WindowsPackageCab changes for example tests
X-Guardian May 1, 2019
66f9f13
Sample_WindowsOptionalFeature Changes
X-Guardian May 1, 2019
841afa0
Fix Pester 'Multiple Script Modules' error
X-Guardian May 4, 2019
98ee363
Add resourceSetHelpName var
X-Guardian May 4, 2019
15828e9
Fix resourceSetHelpName var
X-Guardian May 4, 2019
6be1629
Force integration test re-run
X-Guardian May 4, 2019
f77ce1f
resourceSetHelpFilePath fix
X-Guardian May 4, 2019
e602741
Test: Disable import-module ResourceSetHelper
X-Guardian May 4, 2019
e4adbc2
Merge branch 'Example-Fix' of https://github.com/X-Guardian/PsdscReso…
X-Guardian Jun 3, 2019
d2a97d8
Revert ResourceSetHelper.Ttests change
X-Guardian Jun 4, 2019
52deead
Merge branch 'dev' into Example-Fix
X-Guardian Jun 21, 2019
a180ef4
Merge branch 'dev' into Example-Fix
PlagueHO Oct 4, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .MetaTestOptIn.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[
"Common Tests - Validate Module Files",
"Common Tests - Validate Script Files",
"Common Tests - Validate Example Files",
"Common Tests - Relative Path Length"
]
2 changes: 1 addition & 1 deletion Examples/Sample_Script.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
.PARAMETER FileContent
The content to set for the new file.
#>
Configuration ScriptExample {
Configuration Sample_Script {
[CmdletBinding()]
param
(
Expand Down
2 changes: 1 addition & 1 deletion Examples/Sample_ServiceSet_BuiltInAccount.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Sets the Secure Socket Tunneling Protocol and DHCP Client services to run under the
built-in account LocalService.
#>
Configuration ServiceSetBuiltInAccountExample
Configuration Sample_ServiceSet_BuiltInAccount
{
Import-DscResource -ModuleName 'PSDscResources'

Expand Down
2 changes: 1 addition & 1 deletion Examples/Sample_ServiceSet_StartServices.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.SYNOPSIS
Ensures that the DHCP Client and Windows Firewall services are running.
#>
Configuration ServiceSetStartExample
Configuration Sample_ServiceSet_StartServices
{
Import-DscResource -ModuleName 'PSDscResources'

Expand Down
20 changes: 13 additions & 7 deletions Examples/Sample_User_CreateUser.ps1
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
Configuration UserExample
Configuration Sample_User_CreateUser
{
param (
param
(
[Parameter(Mandatory = $true)]
[ValidateNotNullorEmpty()]
[System.Management.Automation.PSCredential]
$PasswordCredential
$Credential
)

Import-DscResource -ModuleName PSDscResources

User UserExample
Node localhost
{
Ensure = 'Present' # To ensure the user account does not exist, set Ensure to "Absent"
UserName = 'SomeUserName'
Password = $PasswordCredential # This needs to be a credential object
User UserExample
{
Ensure = 'Present' # To ensure the user account does not exist, set Ensure to "Absent"
UserName = 'SomeUserName'
Password = $Credential # This needs to be a credential object
}
}
}
27 changes: 10 additions & 17 deletions Examples/Sample_User_Generic.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
param
(
[Parameter(Mandatory)]
[System.String]
$ConfigurationName
)

<#
Create a custom configuration by passing in whatever
values you need. $Password is the only param that is
Expand All @@ -14,28 +7,28 @@ param
are optional.
#>

Configuration $ConfigurationName
Configuration Sample_User_Generic
{
param
(
param
(
[System.String]
$UserName = 'Test UserName',

[System.String]
$Description = 'Test Description',

[System.String]
$FullName = 'Test Full Name',

[ValidateSet('Present', 'Absent')]
[System.String]
$Ensure = 'Present',

[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
[System.Management.Automation.Credential()]
$Password,

[System.Boolean]
$Disabled = $false,

Expand All @@ -48,9 +41,9 @@ Configuration $ConfigurationName
[System.Boolean]
$PasswordChangeNotAllowed = $false
)

Import-DscResource -ModuleName 'PSDscResources'

Node Localhost {

User UserResource1
Expand Down
2 changes: 1 addition & 1 deletion Examples/Sample_WindowsFeature.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
in this configuration file currently.
#>

Configuration 'Install_Feature_Telnet_Client'
Configuration Sample_WindowsFeature
{
param
(
Expand Down
2 changes: 1 addition & 1 deletion Examples/Sample_WindowsFeatureSet_Install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Installs the TelnetClient and RSAT-File-Services Windows features, including all their
subfeatures. Logs the operation to the file at 'C:\LogPath\Log.log'.
#>
Configuration WindowsFeatureSetExample_Install
Configuration Sample_WindowsFeatureSet_Install
{
[CmdletBinding()]
param ()
Expand Down
2 changes: 1 addition & 1 deletion Examples/Sample_WindowsFeatureSet_Uninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Uninstalls the TelnetClient and RSAT-File-Services Windows features, including all their
subfeatures. Logs the operation to the file at 'C:\LogPath\Log.log'.
#>
Configuration WindowsFeatureSetExample_Install
Configuration Sample_WindowsFeatureSet_Uninstall
{
[CmdletBinding()]
param ()
Expand Down
15 changes: 9 additions & 6 deletions Examples/Sample_WindowsOptionalFeature.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,25 @@ Configuration Sample_WindowsOptionalFeature
param
(
[Parameter (Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]
$FeatureName,

[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]
$LogPath
)

Import-DscResource -ModuleName 'PSDscResources'

WindowsOptionalFeature TelnetClient
Node localhost
{
Name = $FeatureName
Ensure = 'Present'
LogPath = $LogPath
WindowsOptionalFeature FeatureExample
{
Name = $FeatureName
Ensure = 'Present'
LogPath = $LogPath
}
}
}

Sample_WindowsOptionalFeature
2 changes: 1 addition & 1 deletion Examples/Sample_WindowsOptionalFeatureSet_Disable.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Disables the Windows optional features TelnetClient and LegacyComponents and removes all
files associated with these features.
#>
Configuration WindowsOptionalFeatureSet_Disable
Configuration Sample_WindowsOptionalFeatureSet_Disable
{
Import-DscResource -ModuleName 'PSDscResources'

Expand Down
2 changes: 1 addition & 1 deletion Examples/Sample_WindowsOptionalFeatureSet_Enable.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Internet-Explorer-Optional-amd64 and outputs a log of the operations to a file at the path
'C:\LogPath\Log.txt'.
#>
Configuration WindowsOptionalFeatureSet_Enable
Configuration Sample_WindowsOptionalFeatureSet_Enable
{
Import-DscResource -ModuleName 'PSDscResources'

Expand Down
15 changes: 8 additions & 7 deletions Examples/Sample_WindowsPackageCab.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ Configuration Sample_WindowsPackageCab

Import-DscResource -ModuleName 'PSDscResources'

WindowsPackageCab WindowsPackageCab1
Node localhost
{
Name = $Name
Ensure = 'Present'
SourcePath = $SourcePath
LogPath = $LogPath
WindowsPackageCab WindowsPackageCab1
{
Name = $Name
Ensure = 'Present'
SourcePath = $SourcePath
LogPath = $LogPath
}
}
}

Sample_WindowsPackageCab
3 changes: 2 additions & 1 deletion Tests/Unit/ResourceSetHelper.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ param ()
$errorActionPreference = 'Stop'
Set-StrictMode -Version 'Latest'

$resourceSetHelperName = 'ResourceSetHelper'
$script:testsFolderFilePath = Split-Path -Path $PSScriptRoot -Parent
$script:moduleRootFilePath = Split-Path -Path $script:testsFolderFilePath -Parent
$script:dscResourcesFolderFilePath = Join-Path -Path $script:moduleRootFilePath -ChildPath 'DscResources'
$script:resourceSetHelperFilePath = Join-Path -Path $script:dscResourcesFolderFilePath -ChildPath 'ResourceSetHelper.psm1'
$script:resourceSetHelperFilePath = Join-Path -Path $script:dscResourcesFolderFilePath -ChildPath ($resourceSetHelperName + '.psm1')
Import-Module -Name $script:resourceSetHelperFilePath

InModuleScope 'ResourceSetHelper' {
Expand Down