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
Latest posts by wvsandwijk (see all)
- [PS] How to validate VMWare ESX Certificates - September 7, 2018
- PoSH-Git : unable to start ssh-agent service, error :1058 - July 22, 2018
- [PS] Speedup VMWare PowerShell module - June 11, 2018