This repository has been archived by the owner on Jun 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathSample_WindowsFeature.ps1
68 lines (55 loc) · 2.17 KB
/
Sample_WindowsFeature.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<#
.SYNOPSIS
Creates a custom configuration for installing or uninstalling a Windows role or feature.
.PARAMETER Name
The name of the role or feature to install or uninstall.
Default is 'Telnet-Client'.
.PARAMETER Ensure
Specifies whether the role or feature should be installed ('Present')
or uninstalled ('Absent').
By default this is set to Present.
.PARAMETER IncludeAllSubFeature
Specifies whether or not all subfeatures should be installed or uninstalled with
the specified role or feature. Default is false.
If this property is true and Ensure is set to Present, all subfeatures will be installed.
If this property is false and Ensure is set to Present, subfeatures will not be installed or uninstalled.
If Ensure is set to Absent, all subfeatures will be uninstalled.
.PARAMETER Credential
The credential (if required) to install or uninstall the role or feature.
Optional. This must be added to the Node if it is required, as it is not being set
in this configuration file currently.
.PARAMETER LogPath
The custom path to the log file to log this operation.
If not passed in, the default log path will be used (%windir%\logs\ServerManager.log).
Optional. This must be added to the Node if it is required, as it is not being set
in this configuration file currently.
#>
Configuration 'Install_Feature_Telnet_Client'
{
param
(
[System.String]
$Name = 'Telnet-Client',
[ValidateSet('Present', 'Absent')]
[System.String]
$Ensure = 'Present',
[System.Boolean]
$IncludeAllSubFeature = $false,
[System.Management.Automation.PSCredential]
[System.Management.Automation.Credential()]
$Credential,
[ValidateNotNullOrEmpty()]
[System.String]
$LogPath
)
Import-DscResource -ModuleName 'PSDscResources'
Node Localhost
{
WindowsFeature WindowsFeatureTest
{
Name = $Name
Ensure = $Ensure
IncludeAllSubFeature = $IncludeAllSubFeature
}
}
}