Skip to content

Commit 0d44f1f

Browse files
add blacklists
1 parent 9385d28 commit 0d44f1f

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Modules/CIPPCore/Public/Get-CIPPTextReplacement.ps1

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,17 @@ function Get-CIPPTextReplacement {
1818
if ($Text -isnot [string]) {
1919
return $Text
2020
}
21-
21+
$blacklist = @(
22+
'%serial%',
23+
'%systemroot%',
24+
'%systemdrive%',
25+
'%temp%',
26+
'%tenantid%',
27+
'%tenantfilter%',
28+
'%tenantname%',
29+
'%partnertenantid%',
30+
'%samappid%'
31+
)
2232
$Tenant = Get-Tenants -TenantFilter $TenantFilter
2333
$CustomerId = $Tenant.customerId
2434

@@ -44,7 +54,9 @@ function Get-CIPPTextReplacement {
4454
# Replace custom variables
4555
foreach ($Replace in $Vars.GetEnumerator()) {
4656
$String = '%{0}%' -f $Replace.Key
47-
$Text = $Text -replace $String, $Replace.Value
57+
if ($string -notin $blacklist) {
58+
$Text = $Text -replace $String, $Replace.Value
59+
}
4860
}
4961
#default replacements for all tenants: %tenantid% becomes $tenant.customerId, %tenantfilter% becomes $tenant.defaultDomainName, %tenantname% becomes $tenant.displayName
5062
$Text = $Text -replace '%tenantid%', $Tenant.customerId

0 commit comments

Comments
 (0)