Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

How do i filter the results of get-aduser to only match numerical values

$
0
0

Admittedly i am fairly new to powershell but this is proving more complicated than it needs to be.  I have been asked to export all users from AD and then filter out any user with an employee id that is not the standard form of 6 numbers.  I have tried to output all users using the following one liner which gives me all the data including non standard employee ids

get-aduser-filter {employeeid-like"*"-andmail -like"*"  } -Propertiesdistinguishedname,mail,employeeid|Select-Objectemployeeid,mail, distinguishedname

i now need to whittle that down to only employee ids that are 6 numbers in length and exclude all characters.  I have tried using match instead of like to filter but it seems that is not allowed.

Thanks


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>