Powershell
Checking for non ASCII characters in a String
Function CheckLine($LineSpecChar){
$Split = [regex]::split($linespecchar,"")
$i=0
foreach ($item in $split){
$i++
$ASCII = [int]$item[-0];
if (!($ASCII -ge '32' -and $ASCII -le '123' -or $ASCII -eq '0')){
Write-output "Character $i | '$item' | [$ASCII] | Not a valid ASCII Character in $linespecchar"
}}}
$line = "C:\Cluster–Storage\Volume–2\Server (Name – Location)"
CheckLine $line

More Stories
Running PowerShell Hyper-V and VMWare Modules
Extend the Evaluation Period on Windows Server
Now using Ansible, Chocolatey, Powershell