'Error Get-ADUser: Invalid enumeration context
I currently need to export the groups of all users in my domain and I get the error Error with Get-ADUser: Invalid enumeration context. In the script I indicate an ou that has 1300 users and it only brings me approximately 900. how could i solve it? I attach the script.
I attach the script
Solution 1:[1]
You are hitting the 2 minute time limit. I do not believe there is a way to adjust the timeout, but you can filter:
Get-ADObject -Filter 'CN -like "*a*"'
Repeat a - z
That will give you everyone. You could probably come up with a more creative filter, but this is the answer.
From Microsoft:
Timeout Behavior
The following statements specify timeout conditions within the Active
Directory module and describe what can be done about a timeout them.
The default Active Directory module timeout for all operations is 2
minutes.
For search operation, the Active Directory module uses paging control
with a 2-minute timeout for each page search.
Note: Because a search may involve multiple server page requests the
overall search time may exceed 2 minutes.
A TimeoutException error indicates that a timeout has occurred.
For a search operation, you can choose to use a smaller page size, set
with the ResultPageSize parameter, if you are getting a TimeoutException
error.
If after trying these changes you are still getting a TimeoutException
error, consider optimizing your filter using the guidance in the
Optimizing Filters section of this topic.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Technoob1984 |