Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

Join & Write a Comment

Featured Post

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

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