diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-AddStandardsDeploy.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-AddStandardsDeploy.ps1 index 30a4c2c04fb4..06fd14877704 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-AddStandardsDeploy.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-AddStandardsDeploy.ps1 @@ -16,7 +16,7 @@ Function Invoke-AddStandardsDeploy { try { $Tenants = ($Request.body | Select-Object Select_*).psobject.properties.value - $Settings = ($request.body | Select-Object -Property *, 'v2' -ExcludeProperty Select_*, None ) + $Settings = ($request.body | Select-Object -Property *, v2* -ExcludeProperty Select_*, None ) $Settings.v2 = $true foreach ($Tenant in $tenants) { @@ -37,8 +37,7 @@ Function Invoke-AddStandardsDeploy { } Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message 'Successfully added standards deployment' -Sev 'Info' $body = [pscustomobject]@{'Results' = 'Successfully added standards deployment' } - } - catch { + } catch { Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message "Standards API failed. Error:$($_.Exception.Message)" -Sev 'Error' $body = [pscustomobject]@{'Results' = "Failed to add standard: $($_.Exception.Message)" } } diff --git a/Modules/CIPPCore/Public/Invoke-CIPPStandardsRun.ps1 b/Modules/CIPPCore/Public/Invoke-CIPPStandardsRun.ps1 index ee6b6939a823..d6a1ff13fe58 100644 --- a/Modules/CIPPCore/Public/Invoke-CIPPStandardsRun.ps1 +++ b/Modules/CIPPCore/Public/Invoke-CIPPStandardsRun.ps1 @@ -16,7 +16,7 @@ function Invoke-CIPPStandardsRun { $Tenants = (Get-CIPPAzDataTableEntity @Table -Filter $Filter).JSON | ConvertFrom-Json #Migrate from old standards to new standards. - $Tenants | Where-Object -Property 'v2' -NE $true | ForEach-Object { + $Tenants | Where-Object -Property 'v2.1' -NE $true | ForEach-Object { $OldStd = $_ $OldStd.standards.psobject.properties.name | ForEach-Object { if ($_ -eq 'MailContacts') { @@ -28,10 +28,15 @@ function Invoke-CIPPStandardsRun { remediate = $true } } else { - $OldStd.Standards.$_ | Add-Member -NotePropertyName 'remediate' -NotePropertyValue $true + if ($OldStd.Standards.$_ -eq $true) { + $OldStd.Standards.$_ = @{ remediate = $true } + } else { + $OldStd.Standards.$_ | Add-Member -NotePropertyName 'remediate' -NotePropertyValue $true -Force + } + } } - $OldStd | Add-Member -NotePropertyName 'v2' -NotePropertyValue $true -PassThru -Force + $OldStd | Add-Member -NotePropertyName 'v2.1' -NotePropertyValue $true -PassThru -Force $Entity = @{ PartitionKey = 'standards' RowKey = "$($OldStd.Tenant)" @@ -73,7 +78,7 @@ function Invoke-CIPPStandardsRun { #For each item in our object, run the queue. - foreach ($task in $object | Where-Object -Property Standard -NE 'v2') { + foreach ($task in $object | Where-Object -Property Standard -NotLike 'v2*') { $QueueItem = [pscustomobject]@{ Tenant = $task.Tenant Standard = $task.Standard diff --git a/version_latest.txt b/version_latest.txt index 6ca6df113f09..2871567308a5 100644 --- a/version_latest.txt +++ b/version_latest.txt @@ -1 +1 @@ -4.8.0 \ No newline at end of file +4.8.1 \ No newline at end of file