Powershell: Special characters

Parity123
Parity123 used Ask the Experts™
on
Hello,

I have some userprincipalnames (Windows 2008 R2 active directory) with special characters. (for instance: Š = S with caron). I need to list all the userprincipalnames that have thee special characters in them.


Could you please assist with a script.

Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
"Batchelor", Developer and EE Topic Advisor
Top Expert 2015
Commented:
Use an inverse pattern:
get-aduser  -Filter * | ? { $_.UserPrincipalname -match '[^a-zA-Z0-9-_@.]' } | select UserPrincipalName

Open in new window

This defines allowed characters. Everything NOT in the list will be shown.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial