@@ -24,30 +24,30 @@ function Get-TargetResource
24
24
param
25
25
(
26
26
[Parameter (Mandatory = $true )]
27
- [ValidateSet (" AES 128/128" , " AES 256/256" , " DES 56/56" , " NULL" , " RC2 128/128" , " RC2 40/128" , " RC2 56/128" , " RC4 128/128" , " RC4 40/128" , " RC4 56/128" , " RC4 64/128" , " Triple DES 168" )]
27
+ [ValidateSet (' AES 128/128' , ' AES 256/256' , ' DES 56/56' , ' NULL' , ' RC2 128/128' , ' RC2 40/128' , ' RC2 56/128' , ' RC4 128/128' , ' RC4 40/128' , ' RC4 56/128' , ' RC4 64/128' , ' Triple DES 168' )]
28
28
[System.String ]
29
29
$Cipher ,
30
30
31
31
[Parameter ()]
32
- [ValidateSet (" Present" , " Absent" )]
32
+ [ValidateSet (' Present' , ' Absent' )]
33
33
[System.String ]
34
- $Ensure = " Present"
34
+ $Ensure = ' Present'
35
35
)
36
36
37
37
$RootKey = ' HKLM:SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers'
38
- $Key = $RootKey + " \ " + $cipher
39
- if (Test-SchannelItem - itemKey $Key - enable $true )
38
+ $Key = $RootKey + ' \ ' + $cipher
39
+ if (( Test-SChannelItem - itemKey $Key - enable $true ) -eq $true )
40
40
{
41
- $Result = " Present"
41
+ $Result = ' Present'
42
42
}
43
43
else
44
44
{
45
- $Result = " Absent"
45
+ $Result = ' Absent'
46
46
}
47
47
48
48
$returnValue = @ {
49
- Cipher = [System.String ]$Cipher
50
- Ensure = [System.String ]$Result
49
+ Cipher = [System.String ]$Cipher
50
+ Ensure = [System.String ]$Result
51
51
}
52
52
53
53
$returnValue
@@ -59,28 +59,28 @@ function Set-TargetResource
59
59
param
60
60
(
61
61
[Parameter (Mandatory = $true )]
62
- [ValidateSet (" AES 128/128" , " AES 256/256" , " DES 56/56" , " NULL" , " RC2 128/128" , " RC2 40/128" , " RC2 56/128" , " RC4 128/128" , " RC4 40/128" , " RC4 56/128" , " RC4 64/128" , " Triple DES 168" )]
62
+ [ValidateSet (' AES 128/128' , ' AES 256/256' , ' DES 56/56' , ' NULL' , ' RC2 128/128' , ' RC2 40/128' , ' RC2 56/128' , ' RC4 128/128' , ' RC4 40/128' , ' RC4 56/128' , ' RC4 64/128' , ' Triple DES 168' )]
63
63
[System.String ]
64
64
$Cipher ,
65
65
66
66
[Parameter ()]
67
- [ValidateSet (" Present" , " Absent" )]
67
+ [ValidateSet (' Present' , ' Absent' )]
68
68
[System.String ]
69
- $Ensure = " Present"
69
+ $Ensure = ' Present'
70
70
)
71
71
72
72
$RootKey = ' HKLM:SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers'
73
- $Key = $RootKey + " \ " + $cipher
73
+ $Key = $RootKey + ' \ ' + $cipher
74
74
75
- if ($Ensure -eq " Present" )
75
+ if ($Ensure -eq ' Present' )
76
76
{
77
77
Write-Verbose - Message ($LocalizedData.ItemEnable -f ' Cipher' , $Cipher )
78
- Switch-SchannelItem - itemKey $Key - enable $true
78
+ Switch-SChannelItem - itemKey $Key - enable $true
79
79
}
80
80
else
81
81
{
82
82
Write-Verbose - Message ($LocalizedData.ItemDisable -f ' Cipher' , $Cipher )
83
- Switch-SchannelItem - itemKey $Key - enable $false
83
+ Switch-SChannelItem - itemKey $Key - enable $false
84
84
}
85
85
}
86
86
@@ -91,29 +91,30 @@ function Test-TargetResource
91
91
param
92
92
(
93
93
[Parameter (Mandatory = $true )]
94
- [ValidateSet (" AES 128/128" , " AES 256/256" , " DES 56/56" , " NULL" , " RC2 128/128" , " RC2 40/128" , " RC2 56/128" , " RC4 128/128" , " RC4 40/128" , " RC4 56/128" , " RC4 64/128" , " Triple DES 168" )]
94
+ [ValidateSet (' AES 128/128' , ' AES 256/256' , ' DES 56/56' , ' NULL' , ' RC2 128/128' , ' RC2 40/128' , ' RC2 56/128' , ' RC4 128/128' , ' RC4 40/128' , ' RC4 56/128' , ' RC4 64/128' , ' Triple DES 168' )]
95
95
[System.String ]
96
96
$Cipher ,
97
97
98
98
[Parameter ()]
99
- [ValidateSet (" Present" , " Absent" )]
99
+ [ValidateSet (' Present' , ' Absent' )]
100
100
[System.String ]
101
- $Ensure = " Present"
101
+ $Ensure = ' Present'
102
102
)
103
103
104
104
$RootKey = ' HKLM:SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers'
105
- $Key = $RootKey + " \ " + $cipher
105
+ $Key = $RootKey + ' \ ' + $cipher
106
106
$currentCipher = Get-TargetResource @PSBoundParameters
107
107
$Compliant = $false
108
108
109
- $ErrorActionPreference = " SilentlyContinue"
109
+ $ErrorActionPreference = ' SilentlyContinue'
110
110
Write-Verbose - Message ($LocalizedData.ItemTest -f ' Cipher' , $Cipher )
111
- if ($currentCipher.Ensure -eq $Ensure -and (Get-ItemProperty - Path $Key - Name Enabled))
111
+ if ($currentCipher.Ensure -eq $Ensure -and `
112
+ (Get-ItemProperty - Path $Key - Name Enabled))
112
113
{
113
114
$Compliant = $true
114
115
}
115
116
116
- if ($Compliant )
117
+ if ($Compliant -eq $true )
117
118
{
118
119
Write-Verbose - Message ($LocalizedData.ItemCompliant -f ' Cipher' , $Cipher )
119
120
}
0 commit comments