• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 88
  • Last Modified:

make get-aduser or get-adcomputer only 10 counts for testing

I'm making script against 10k user AD users, but while I'm writing codes, it takes too long to get values.
Is there any way to limit number of returned raw from get-aduser so that I can test codes more fast and efficiently? I only need like 10 users to be returned then run other codes below the codes.
Sungpill Han
Sungpill Han
2 Solutions
David Johnson, CD, MVPOwnerCommented:
change your filter or use -searchbase to only select one OU or -ResultSetSize:XX replace XX with the # of entries you want to retrieve
Examples of what David stated above

Get-ADUser -Filter * -SearchBase 'OU' -ResultSetSize 10 -Properties name | select name

Open in new window

Get-ADUser -Filter * -ResultSetSize 10 -Properties name | select name

Open in new window

Sungpill HanAuthor Commented:
Thank you.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now