Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while running the script #98

Closed
3 tasks done
jpcapone opened this issue May 27, 2023 · 15 comments · Fixed by #111
Closed
3 tasks done

Error while running the script #98

jpcapone opened this issue May 27, 2023 · 15 comments · Fixed by #111
Assignees
Labels
bug Something isn't working wontfix This will not be worked on
Milestone

Comments

@jpcapone
Copy link

Bug description

While running any cmdlet to generate the AD report I get the error: the server has returned the following error invalid enumeration context while running Get-Aduser

Command-line input

New-AsBuiltReport -Report Microsoft.AD -Target 'admin-dc-01v.contoso.local' -Username '[email protected]' -Password 'P@ssw0rd' -Format Html,Word -OutputFolderPath 'C:\Users\Jon\Documents' -Timestamp

Steps to reproduce

The error occurs after running New-AsBuiltReport -Report Microsoft.AD -Target 'admin-dc-01v.contoso.local' -Username '[email protected]' -Password 'P@ssw0rd' -Format Html,Word -OutputFolderPath 'C:\Users\Jon\Documents' -Timestamp

Expected behaviour

Script should run to completion with no errors.

Screenshots

No response

Operating System

Windows Server 2019

PowerShell Version

5.1.22621.963

PowerShell Modules


Name                       Version
----                       -------
AsBuiltReport.Core         1.3.0  
AsBuiltReport.Microsoft.AD 0.7.12 
PScribo                    0.10.0 
PScriboCharts              0.9.0  
PSPKI                      3.7.2 

Additional Context

The script does complete after the error occurs. i believe it is caused by the number of users theGet-ADUsercmdlet has to parse
which is roughly 265000 users. I ran another script to validate the user object count and found that the difference in the value was neglible but very close.

Before submitting

@jpcapone jpcapone added the bug Something isn't working label May 27, 2023
@rebelinux
Copy link
Collaborator

Hello:

can you tell me which specific table in the report you are referring to?

thanks!

@rebelinux rebelinux added this to the v0.7.13 milestone May 28, 2023
rebelinux added a commit to rebelinux/AsBuiltReport.Microsoft.AD that referenced this issue May 28, 2023
@jpcapone
Copy link
Author

The Users Object Count Pie Chart and Table - 1.2.1.3.3.

@jpcapone
Copy link
Author

Heres a screenshot:
image

@rebelinux
Copy link
Collaborator

Thanks for the info,

could you share with me the other script you run to compare the numbers?

@jpcapone
Copy link
Author

I kept it simple
(Get-ADUser -Filter *).Count

@rebelinux
Copy link
Collaborator

rebelinux commented May 29, 2023

I have done a test on a larger environment than yours and I can't reproduce the error. However, I made some changes in the code to see if it can help to avoid this type of error.

PS C:\Users\jocolon> (Get-ADUser -Filter *).Count
278838
PS C:\Users\jocolon> (Get-ADGroup -Filter *).Count
14693
PS C:\Users\jocolon> (Get-ADComputer -Filter *).Count
57150

Another question is if you executed the command with the EnableHealthCheck option?

@jpcapone
Copy link
Author

I have gotten the error with and without the EnableHealthCheck option. Its weird that you didn't get the same error. If I update my module will the changes you made be downloaded?

rebelinux added a commit to rebelinux/AsBuiltReport.Microsoft.AD that referenced this issue May 30, 2023
rebelinux added a commit to rebelinux/AsBuiltReport.Microsoft.AD that referenced this issue Jun 4, 2023
rebelinux added a commit to rebelinux/AsBuiltReport.Microsoft.AD that referenced this issue Jun 14, 2023
@rebelinux rebelinux added the wontfix This will not be worked on label Jun 17, 2023
@rebelinux
Copy link
Collaborator

I analyzed this situation in depth and was able to recreate the issue. I found that the error is caused when the powershell process consumes too much memory caused by the excessive amount of objects it has to process.

As much as I have improved the code I have not found a way through powershell to correct the error because most of the time it works but in certain occasions the error is displayed.

rebelinux added a commit to rebelinux/AsBuiltReport.Microsoft.AD that referenced this issue Jun 19, 2023
@jpcapone
Copy link
Author

I greatly appreciate your efforts. If you need someone to help test any changes please let me know.

@rebelinux rebelinux mentioned this issue Jun 23, 2023
7 tasks
@rebelinux rebelinux mentioned this issue Jun 23, 2023
7 tasks
@rebelinux
Copy link
Collaborator

I greatly appreciate your efforts. If you need someone to help test any changes please let me know.

v0.7.13 is out with a lot of changes!

@jpcapone
Copy link
Author

I greatly appreciate your efforts. If you need someone to help test any changes please let me know.

I attempted to update the cert but i am getting the error in the screenshot. I know I can skip publisher and force the install but, hmmmm......

image

@rebelinux
Copy link
Collaborator

I updated PSPKI to version 4.0.0.0 with no problems. Additionally I ran the report with that version and didn't encounter any issues.

@jpcapone
Copy link
Author

jpcapone commented Jun 23, 2023

I updated PSPKI to version 4.0.0.0 with no problems. Additionally I ran the report with that version and didn't encounter any issues.

I got the same certificate error when I attempted to run the PSPKI update as well. You didn't get that error for either?

@rebelinux
Copy link
Collaborator

When I did the update on one of my computers I did not get that error.

I have seen this error in other powershell modules and it is a known PowerShellGet issue.

PowerShell/PowerShellGetv2#650

The use of the -SkipPublisherCheck parameter solves the problem.

However, I will modify the README file to include a comment on this possible issue. Thank you.

@rebelinux rebelinux reopened this Jun 23, 2023
@rebelinux
Copy link
Collaborator

Any opinion on this matter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants