Created
May 18, 2020 17:19
-
-
Save thedavecarroll/18ca62625df31fe82ba431b80f6ba2f5 to your computer and use it in GitHub Desktop.
Validate Two Letter Region Names with PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $TwoLetterISORegionNames = Get-Culture -ListAvailable | | |
| Foreach-Object { | |
| try { [System.Globalization.RegionInfo]::new($_.Name) } | |
| catch {} | |
| } | | |
| Select-Object -ExpandProperty TwoLetterISORegionName | Sort-Object -Unique | |
| 'US','CA','UK' | % { $_ -in $TwoLetterISORegionNames ? '{0} is valid' -f $_ : '{0} is not valid' -f $_ } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment