diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecEditTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecEditTemplate.ps1 index 61905a757faf..0d765e27a478 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecEditTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecEditTemplate.ps1 @@ -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 diff --git a/Modules/CIPPCore/Public/Invoke-CIPPStandardsRun.ps1 b/Modules/CIPPCore/Public/Invoke-CIPPStandardsRun.ps1 index ea1e553903fe..2b2016230ad6 100644 --- a/Modules/CIPPCore/Public/Invoke-CIPPStandardsRun.ps1 +++ b/Modules/CIPPCore/Public/Invoke-CIPPStandardsRun.ps1 @@ -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. diff --git a/Modules/CIPPCore/Public/Standards/Get-CIPPStandards.ps1 b/Modules/CIPPCore/Public/Standards/Get-CIPPStandards.ps1 index 4bf96e3b2787..e69927b304d3 100644 --- a/Modules/CIPPCore/Public/Standards/Get-CIPPStandards.ps1 +++ b/Modules/CIPPCore/Public/Standards/Get-CIPPStandards.ps1 @@ -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 { diff --git a/Modules/CIPPCore/Public/Test-CIPPRerun.ps1 b/Modules/CIPPCore/Public/Test-CIPPRerun.ps1 index b8e27a6b4269..39384ad879bc 100644 --- a/Modules/CIPPCore/Public/Test-CIPPRerun.ps1 +++ b/Modules/CIPPCore/Public/Test-CIPPRerun.ps1 @@ -6,7 +6,8 @@ function Test-CIPPRerun { $API, $Settings, $ExecutingUser, - [switch]$Clear + [switch]$Clear, + [switch]$ClearAll ) $RerunTable = Get-CIPPTable -tablename 'RerunCache' $EstimatedDifference = switch ($Type) { @@ -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