Skip to content

Commit 4d8d0f2

Browse files
committed
fix sanitized table props
1 parent 92af318 commit 4d8d0f2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Modules/CIPPCore/Public/Set-CIPPStandardsCompareField.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ function Set-CIPPStandardsCompareField {
66
)
77
$Table = Get-CippTable -tablename 'CippStandardsReports'
88
$TenantName = Get-Tenants | Where-Object -Property defaultDomainName -EQ $Tenant
9-
#if the fieldname does not contain standards. prepend it.
10-
$FieldName = $FieldName -replace '\.', '_'
9+
10+
# Sanitize invalid c#/xml characters for Azure Tables
11+
$FieldName = $FieldName.replace('standards.', 'standards_')
12+
$FieldName = $FieldName.replace('IntuneTemplate.', 'IntuneTemplate_')
13+
$FieldName = $FieldName -replace '-', '__'
14+
1115
if ($FieldValue -is [System.Boolean]) {
1216
$fieldValue = [bool]$FieldValue
1317
} elseif ($FieldValue -is [string]) {
@@ -40,6 +44,6 @@ function Set-CIPPStandardsCompareField {
4044
}
4145
Write-Information "Adding $FieldName to StandardCompare for $Tenant. content is $FieldValue"
4246
} catch {
43-
Write-Warning "Failed to add $FieldName to StandardCompare for $Tenant. content is $FieldValue. The error was: $($_.Exception.Message)"
47+
Write-Warning "Failed to add $FieldName to StandardCompare for $Tenant. content is $FieldValue - $($_.Exception.Message)"
4448
}
4549
}

0 commit comments

Comments
 (0)