Skip to content

Instantly share code, notes, and snippets.

@jeffbuenting
Created March 17, 2016 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffbuenting/6e47f34b305daf89c29d to your computer and use it in GitHub Desktop.
Save jeffbuenting/6e47f34b305daf89c29d to your computer and use it in GitHub Desktop.
Enter file contents hereFunction Get-Diacritic {
<#
.Synopsis
Creates a report of files that do not contain diacritic characters.
.Description
Emails a report of files that do not contain diacritic characters ( ascii chars between 80 and FF hex )
.Parameter Searchroot
Folder to begin the search
.Parameter Sendto
Email of person to who will recieve the report
.Parameter SMTPServer
IP address of the SMTPServer
.Example
Get-Diacritic -SearchRoot F:\FileShare -Sendto Jeff.buenting@email.com -SMTPServer mail.stratuslive.com
#>
[CmdletBinding()]
Param (
[Parameter( Mandatory=$True)]
[String]$SearchRoot,
[Parameter( Mandatory=$True)]
[String[]]$Sendto,
[Parameter( Mandatory=$True)]
[String]$SMTPServer
)
Write-Verbose "Checking $SearchRoot for Diacritic marks"
$DiaCriticFiles = Get-ChildItem -Path F:\FileShare -recurse | where name -Match '[\u0080-\u00ff]'
Write-Verbose "Sending Filename report"
Send-MailMessage -To $Sendto -From ServerMonitor@Corp.com -SmtpServer $SMTPServer -Subject 'Files with diacritical marks' -Body "Scan of $(Get-Date -UFormat '%Y-%m-%d'): $(DiacriticFiles.Count) filenames with diacritic marks found under $SearchRoot`n`n$($DiacriticFiles | ft Name,Directory,@{N='Creation Date';E={$_.CreationTime}},@{N='Last Modification Date';E={$_.LastWriteTime}},@{N='File Size';E={$_.Length}} -AutoSize) "
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment