Skip to content

Commit

Permalink
Merge pull request #30 from KelvinTegelaar/dev
Browse files Browse the repository at this point in the history
[pull] dev from KelvinTegelaar:dev
  • Loading branch information
pull[bot] authored Jan 27, 2025
2 parents 3f8b2c8 + 079df36 commit d1e2ffe
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ Function Invoke-ExecEditTemplate {

if ($Type -eq 'IntuneTemplate') {
Write-Host 'Intune Template'
$OriginalTemplate = Get-CIPPAzDataTableEntity @Table -Filter "PartitionKey eq 'IntuneTemplate' and GUID eq '$GUID'"
$OriginalTemplate = Get-CIPPAzDataTableEntity @Table -Filter "PartitionKey eq 'IntuneTemplate' and RowKey eq '$GUID'"
$OriginalTemplate = ($OriginalTemplate.JSON | ConvertFrom-Json -Depth 100)
$RawJSON = $OriginalTemplate.RAWJson
Set-CIPPIntuneTemplate -RawJSON $RawJSON -GUID $GUID -DisplayName $Request.body.displayName -Description $Request.body.description -templateType $Request.body.type
Set-CIPPIntuneTemplate -RawJSON $RawJSON -GUID $GUID -DisplayName $Request.body.displayName -Description $Request.body.description -templateType $OriginalTemplate.Type
} else {
$Table.Force = $true

Expand Down
7 changes: 2 additions & 5 deletions Modules/CIPPCore/Public/Invoke-CIPPStandardsRun.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@ function Invoke-CIPPStandardsRun {
$runManually = $false

)
Write-Host "Starting process for standards - $($tenantFilter)"
Write-Host "Starting process for standards - $($tenantFilter). TemplateID: $($TemplateID) RunManually: $($runManually) Force: $($Force.IsPresent)"

$AllTasks = Get-CIPPStandards

if ($Force.IsPresent) {
Write-Host 'Clearing Rerun Cache'
foreach ($Task in $AllTasks) {
Write-Host "Clearing $($Task.Standard)_$($TemplateID)"
$null = Test-CIPPRerun -Type Standard -Tenant $Task.Tenant -API "$($Task.Standard)_$($TemplateID)" -Clear
}
Test-CIPPRerun -ClearAll -TenantFilter $TenantFilter -Type 'Standard'
}

#For each item in our object, run the queue.
Expand Down
4 changes: 2 additions & 2 deletions Modules/CIPPCore/Public/Standards/Get-CIPPStandards.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ function Get-CIPPStandards {
$Table = Get-CippTable -tablename 'templates'
$Filter = "PartitionKey eq 'StandardsTemplateV2'"
$Templates = (Get-CIPPAzDataTableEntity @Table -Filter $Filter | Sort-Object TimeStamp).JSON | ForEach-Object {
#in the string $_, replace the word 'action' by the word 'Action'.
try {
$_ -replace 'Action', 'action' | ConvertFrom-Json -InputObject $_ -ErrorAction SilentlyContinue
$JSON = ($_).replace('"Action":', '"action":') #fix cap mistake of antique standards
ConvertFrom-Json -InputObject $JSON -ErrorAction SilentlyContinue
} catch {
}
} | Where-Object {
Expand Down
9 changes: 8 additions & 1 deletion Modules/CIPPCore/Public/Test-CIPPRerun.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ function Test-CIPPRerun {
$API,
$Settings,
$ExecutingUser,
[switch]$Clear
[switch]$Clear,
[switch]$ClearAll
)
$RerunTable = Get-CIPPTable -tablename 'RerunCache'
$EstimatedDifference = switch ($Type) {
Expand All @@ -19,6 +20,12 @@ function Test-CIPPRerun {

try {
$RerunData = Get-CIPPAzDataTableEntity @RerunTable -filter "PartitionKey eq '$($TenantFilter)' and RowKey eq '$($Type)_$($API)'"
if ($ClearAll.IsPresent) {
$AllRerunData = Get-CIPPAzDataTableEntity @RerunTable
Remove-AzDataTableEntity @RerunTable -Entity $AllRerunData -Force
return $false
}

if ($Clear.IsPresent) {
if ($RerunData) {
Remove-AzDataTableEntity @RerunTable -Entity $RerunData
Expand Down

0 comments on commit d1e2ffe

Please sign in to comment.