Skip to content

Commit 2d7fa42

Browse files
committed
feat: initial commit
1 parent 2edbdc0 commit 2d7fa42

File tree

16 files changed

+624
-0
lines changed

16 files changed

+624
-0
lines changed

New-CompositeRessource.ps1

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#Requires -Modules @{ ModuleName="Plaster"; ModuleVersion="1.1.3" }
2+
3+
[CmdletBinding()]
4+
param (
5+
[Parameter(Mandatory=$true)]
6+
[ValidateNotNullOrEmpty()]
7+
[string]
8+
$Module,
9+
[Parameter(Mandatory=$true)]
10+
[ValidateNotNullOrEmpty()]
11+
[string]
12+
$Version,
13+
[Parameter(Mandatory=$true)]
14+
[ValidateNotNullOrEmpty()]
15+
[string]
16+
$Ressource,
17+
[Parameter()]
18+
[ValidateNotNullOrEmpty()]
19+
[string]
20+
$Company = "XOSS"
21+
)
22+
23+
$globalPrefix = "XOSS"
24+
$curDirectory = Resolve-Path .\
25+
$templatePath = Join-Path $curDirectory "templates"
26+
$rootModulePath = Resolve-Path ..\..\
27+
$Module = "${globalPrefix}${Module}DSC"
28+
$modulePath = Join-Path $rootModulePath "$Module"
29+
$moduleVersionPath = Join-Path $modulePath $Version
30+
$moduleRessources = Join-Path $moduleVersionPath "DSCResources"
31+
$ressourcePath = Join-Path $moduleRessources $Ressource
32+
33+
34+
Write-Output "Checking if module $Module already exists under $moduleVersionPath"
35+
36+
if(Test-Path "$moduleVersionPath")
37+
{
38+
Write-Output "Module $Module with version $Version already exists. Continuing."
39+
}
40+
else
41+
{
42+
Write-Warning "Module $Module with version $Version does not exist. Creating new module. Please provide missing data."
43+
$template = Join-Path $templatePath "shared_module"
44+
$moduleData = @{
45+
project_name = $Module
46+
version = $Version
47+
company = $Company
48+
TemplatePath = "$template"
49+
DestinationPath = "$moduleVersionPath"
50+
}
51+
52+
Invoke-Plaster @moduleData
53+
}
54+
55+
56+
Write-Output "Going to check if ressource $Ressource exists under $ressourcePath"
57+
58+
if(Test-Path "$ressourcePath")
59+
{
60+
Write-Error "Ressource $Ressource already exists. Aborting"
61+
}
62+
else
63+
{
64+
Write-Output "Creating new ressource $Ressource for module $Module"
65+
$template = Join-Path $templatePath "composite_resource"
66+
$moduleData = @{
67+
project_name = "${Ressource}"
68+
version = "1.0.0"
69+
company = $Company
70+
TemplatePath = "$template"
71+
DestinationPath = "$ressourcePath"
72+
}
73+
74+
Invoke-Plaster @moduleData
75+
}

Readme.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Getting started
2+
3+
This scripts are used to easly create new dsc composite ressources.
4+
5+
## Prerequisites
6+
7+
Please install Plaster at first and make sure it's present.
8+
9+
´´PowerShell
10+
Install-Module Plaster
11+
Import-Module Plaster
12+
``
13+
14+
## Creating new modules
15+
16+
Modules will be automatically created once you are creating a new composite ressource.
17+
18+
## Creating new composite ressources
19+
20+
Composite ressources can easily be deployed via the invocation of
21+
22+
´´PowerShell
23+
.\New-CompositeRessource.ps1
24+
``
25+
26+
with parameters
27+
28+
´´PowerShell
29+
.\New-CompositeRessource.ps1 -Module W2K19DC1903Baseline -Version 1.0.0 -Ressource ScheduledTasks
30+
``
31+
The parameter list is as followed:
32+
33+
|Parameter |Description |Note
34+
| ------------- | ----------------------------------------- | ------------- |
35+
|Module |Name of the outer module part | -
36+
|Version |Target version of the module | -
37+
|Ressource |The name of the ressource /config part | -
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
#
2+
# Module manifest for module 'ScheduledTasks'
3+
#
4+
# Generated by: XOAP
5+
#
6+
# Generated on: 12.05.2022
7+
#
8+
9+
@{
10+
11+
# Script module or binary module file associated with this manifest.
12+
RootModule = 'ScheduledTasks.schema.psm1'
13+
14+
# Version number of this module.
15+
ModuleVersion = '1.0.0'
16+
17+
# Supported PSEditions
18+
# CompatiblePSEditions = @()
19+
20+
# ID used to uniquely identify this module
21+
GUID = 'e4833b1b-2639-4be2-9e65-7e3d5f4a8ef0'
22+
23+
# Author of this module
24+
Author = 'XOAP'
25+
26+
# Company or vendor of this module
27+
CompanyName = 'XOAP'
28+
29+
# Copyright statement for this module
30+
Copyright = '(c) XOAP.io. All rights reserved.'
31+
32+
# Description of the functionality provided by this module
33+
Description = 'ScheduledTasks'
34+
35+
# Minimum version of the PowerShell engine required by this module
36+
# PowerShellVersion = ''
37+
38+
# Name of the PowerShell host required by this module
39+
# PowerShellHostName = ''
40+
41+
# Minimum version of the PowerShell host required by this module
42+
# PowerShellHostVersion = ''
43+
44+
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
45+
# DotNetFrameworkVersion = ''
46+
47+
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
48+
# CLRVersion = ''
49+
50+
# Processor architecture (None, X86, Amd64) required by this module
51+
# ProcessorArchitecture = ''
52+
53+
# Modules that must be imported into the global environment prior to importing this module
54+
# RequiredModules = @()
55+
56+
# Assemblies that must be loaded prior to importing this module
57+
# RequiredAssemblies = @()
58+
59+
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
60+
# ScriptsToProcess = @()
61+
62+
# Type files (.ps1xml) to be loaded when importing this module
63+
# TypesToProcess = @()
64+
65+
# Format files (.ps1xml) to be loaded when importing this module
66+
# FormatsToProcess = @()
67+
68+
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
69+
# NestedModules = @()
70+
71+
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
72+
FunctionsToExport = '*'
73+
74+
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
75+
CmdletsToExport = '*'
76+
77+
# Variables to export from this module
78+
VariablesToExport = '*'
79+
80+
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
81+
AliasesToExport = '*'
82+
83+
# DSC resources to export from this module
84+
# DscResourcesToExport = @()
85+
86+
# List of all modules packaged with this module
87+
# ModuleList = @()
88+
89+
# List of all files packaged with this module
90+
# FileList = @()
91+
92+
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
93+
PrivateData = @{
94+
95+
PSData = @{
96+
97+
# Tags applied to this module. These help with module discovery in online galleries.
98+
# Tags = @()
99+
100+
# A URL to the license for this module.
101+
# LicenseUri = ''
102+
103+
# A URL to the main website for this project.
104+
# ProjectUri = ''
105+
106+
# A URL to an icon representing this module.
107+
# IconUri = ''
108+
109+
# ReleaseNotes of this module
110+
# ReleaseNotes = ''
111+
112+
} # End of PSData hashtable
113+
114+
} # End of PrivateData hashtable
115+
116+
# HelpInfo URI of this module
117+
# HelpInfoURI = ''
118+
119+
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
120+
# DefaultCommandPrefix = ''
121+
122+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
configuration ScheduledTasks
2+
{
3+
[CmdletBinding()]
4+
param (
5+
[Parameter()]
6+
[TypeName]
7+
$ParameterName
8+
)
9+
10+
#Import-DSCResource -ModuleName xPSDesiredStateConfiguration
11+
#
12+
#xRegistry disableInsecureCipher_a
13+
#{
14+
# Key = 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\DES 56/56'
15+
# ValueName = 'Enabled'
16+
# ValueData = '0'
17+
# ValueType = 'Dword'
18+
# Ensure = 'Present'
19+
# Force = $true
20+
#}
21+
22+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
configuration default
2+
{
3+
param
4+
(
5+
# Target nodes to apply the configuration
6+
[string[]]$NodeName = 'localhost'
7+
)
8+
9+
Import-Module XOAPBaselineW2k19DSC
10+
Import-DSCResource -ModuleName XOAPBaselineW2k19DSC
11+
12+
Node $NodeName
13+
{
14+
15+
$moduleRoot = [io.path]::GetDirectoryName((Get-Module XOAPBaselineW2k19DSC).Path)
16+
$examples = "$moduleRoot\Examples"
17+
18+
# Install the IIS role
19+
WindowsFeature IIS
20+
{
21+
Ensure = "Present"
22+
Name = "Web-Server"
23+
}
24+
25+
}
26+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# XOSSBaselineW2k19DSC
2+
3+
The XOSSBaselineW2k19DSC PowerShell module provides
4+
DSC resources that can be used to ... (explain what functionality the resources are meant to provide)
5+
6+
## Installation
7+
8+
To manually install the module, download the source code and unzip the contents
9+
of the \Modules\XOSSBaselineW2k19DSC directory to the
10+
$env:ProgramFiles\WindowsPowerShell\Modules folder
11+
12+
To install from the PowerShell gallery using PowerShellGet (in PowerShell 5.0)
13+
run the following command:
14+
15+
Find-Module -Name XOSSBaselineW2k19DSC -Repository PSGallery | Install-Module
16+
17+
To confirm installation, run the below command and ensure you see the
18+
XOSSBaselineW2k19DSC DSC resoures available:
19+
20+
Get-DscResource -Module XOSSBaselineW2k19DSC
21+
22+
## Usage
23+
24+
Include the following in your DSC configuration
25+
26+
Import-DSCResource -ModuleName XOSSBaselineW2k19DSC
27+
28+
### MyResource
29+
30+
MyResource resourceName {
31+
Ensure = "Present"
32+
}
33+
34+
## Requirements
35+
36+
The minimum PowerShell version required is 4.0, which ships in Windows 8.1
37+
or Windows Server 2012R2 (or higher versions). The preferred version is
38+
PowerShell 5.0 or higher, which ships with Windows 10 or Windows Server 2016.
39+

0 commit comments

Comments
 (0)