Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Enter file contents hereFunction Get-Diacritic {
Creates a report of files that do not contain diacritic characters.
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
Get-Diacritic -SearchRoot F:\FileShare -Sendto -SMTPServer
Param (
[Parameter( Mandatory=$True)]
[Parameter( Mandatory=$True)]
[Parameter( Mandatory=$True)]
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 -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