- String Manipulation: PowerShell easily handles string manipulations like converting to uppercase and removing spaces.
- Regular Expression Support: PowerShell supports complex regular expressions, making it suitable for validating the ICAN address format.
- Handling Large Numbers: By leveraging
[System.Numerics.BigInteger]
, PowerShell can handle the large numbers resulting from converting the ICAN address to its numeric equivalent for the mod 97 check, overcoming the limitations present in batch scripts. - Simplified Syntax: PowerShell's syntax is more readable and concise for tasks like substring extraction and for-loop iterations compared to batch scripting.
To execute this PowerShell script, you might need to adjust your execution policy settings if you encounter any restrictions. You can do this by running PowerShell as an Administrator and executing:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
Choose "Yes" or "A" (Yes to All) when prompted to change the policy. This policy setting allows scripts to run on your system. Then, navigate to the directory containing your script and run it with:
.\ican-validator.ps1
This script will perform the ICAN address validation.