• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 79
  • 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

WEBINAR: GDPR Implemented - Tips & Lessons Learned

Join the WatchGuard team on Thursday, March 29th as we recount some valuable lessons learned in weighing the needs of a business against the new regulatory environment, look ahead at the two months left before implementation, and help you understand the steps you can take today!

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