Skip to content

Commit ebb3bf3

Browse files
autoremediate true thing
1 parent e113e57 commit ebb3bf3

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

Modules/CIPPCore/Public/Standards/Get-CIPPStandards.ps1

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,21 @@ function Get-CIPPStandards {
6161
$CurrentStandard | Add-Member -NotePropertyName 'TemplateId' -NotePropertyValue $Template.GUID -Force
6262

6363
if ($CurrentStandard.action.value -contains 'Remediate' -and -not ($CurrentStandard.action.value -contains 'Report')) {
64+
Write-Host 'STRDS: autoRemediate set to true, adding Remediate action'
65+
6466
$reportAction = [pscustomobject]@{
6567
label = 'Report'
6668
value = 'Report'
6769
}
6870
$CurrentStandard.action = @($CurrentStandard.action) + $reportAction
6971
}
72+
#If its a drift template, with autoRemediate, we add the Remediate action.
73+
if ($CurrentStandard.autoRemediate -eq $true) {
74+
$CurrentStandard.action = @($CurrentStandard.action) + [pscustomobject]@{
75+
label = 'Remediate'
76+
value = 'Remediate'
77+
}
78+
}
7079

7180
$Actions = $CurrentStandard.action.value
7281
if ($Actions -contains 'Remediate' -or $Actions -contains 'warn' -or $Actions -contains 'Report') {
@@ -90,6 +99,14 @@ function Get-CIPPStandards {
9099
}
91100
$CurrentStandard.action = @($CurrentStandard.action) + $reportAction
92101
}
102+
#If its a drift template, with autoRemediate, we add the Remediate action.
103+
if ($CurrentStandard.autoRemediate -eq $true) {
104+
Write-Host 'STRDS: autoRemediate set to true, adding Remediate action'
105+
$CurrentStandard.action = @($CurrentStandard.action) + [pscustomobject]@{
106+
label = 'Remediate'
107+
value = 'Remediate'
108+
}
109+
}
93110

94111
$Actions = $CurrentStandard.action.value
95112
if ($Actions -contains 'Remediate' -or $Actions -contains 'warn' -or $Actions -contains 'Report') {
@@ -235,6 +252,14 @@ function Get-CIPPStandards {
235252
}
236253
$CurrentStandard.action = @($CurrentStandard.action) + $reportAction
237254
}
255+
#If its a drift template, with autoRemediate, we add the Remediate action.
256+
if ($CurrentStandard.autoRemediate -eq $true) {
257+
Write-Host 'STRDS: autoRemediate set to true, adding Remediate action'
258+
$CurrentStandard.action = @($CurrentStandard.action) + [pscustomobject]@{
259+
label = 'Remediate'
260+
value = 'Remediate'
261+
}
262+
}
238263

239264
$Actions = $CurrentStandard.action.value
240265
if ($Actions -contains 'Remediate' -or $Actions -contains 'warn' -or $Actions -contains 'Report') {
@@ -269,6 +294,14 @@ function Get-CIPPStandards {
269294
}
270295
$CurrentStandard.action = @($CurrentStandard.action) + $reportAction
271296
}
297+
#If its a drift template, with autoRemediate, we add the Remediate action.
298+
if ($CurrentStandard.autoRemediate -eq $true) {
299+
Write-Host 'STRDS: autoRemediate set to true, adding Remediate action'
300+
$CurrentStandard.action = @($CurrentStandard.action) + [pscustomobject]@{
301+
label = 'Remediate'
302+
value = 'Remediate'
303+
}
304+
}
272305

273306
# Filter actions only 'Remediate','warn','Report'
274307
$Actions = $CurrentStandard.action.value | Where-Object { $_ -in 'Remediate', 'warn', 'Report' }
@@ -292,6 +325,14 @@ function Get-CIPPStandards {
292325
}
293326
$CurrentStandard.action = @($CurrentStandard.action) + $reportAction
294327
}
328+
#If its a drift template, with autoRemediate, we add the Remediate action.
329+
if ($CurrentStandard.autoRemediate -eq $true) {
330+
Write-Host 'STRDS: autoRemediate set to true, adding Remediate action'
331+
$CurrentStandard.action = @($CurrentStandard.action) + [pscustomobject]@{
332+
label = 'Remediate'
333+
value = 'Remediate'
334+
}
335+
}
295336

296337
$Actions = $CurrentStandard.action.value | Where-Object { $_ -in 'Remediate', 'warn', 'Report' }
297338
if ($Actions -contains 'Remediate' -or $Actions -contains 'warn' -or $Actions -contains 'Report') {

0 commit comments

Comments
 (0)