The script is returning results from both publishing sites and other sites. But it only returns CEWP's which have script tags in it or CEWP's which has a contentlink that point to a textfile with scripts. If you want all CEWP's, you need to adapt the Get-CEWP function. Replace the following code:
if ($webPart.ContentLink.Length -gt 0)
{
# Check file in ContentLink for script tags
$file = $web.GetFile($webPart.ContentLink)
$data = $file.OpenBinary()
$encode = New-Object System.Text.ASCIIEncoding
$contents = $encode.GetString($data)
if ($contents.ToLower().Contains("<script>"))
{
Write-Output "$($web.Url)/$url (CONTENTLINK)"
}
break
}
if ($webPart.Content.InnerText.Contains("<script>"))
{
Write-Output "$($web.Url)/$url (HTML)"
}
with:
Write-Output "$($web.Url)/$url"
Then the function will return all CEWP webparts and not only those with script in them.