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

[BUG] Get-PnPTenantSite command does not return any output if the number of sites is greater than 40k #3875

Closed
1 of 6 tasks
rajarshibhargav opened this issue Apr 8, 2024 · 11 comments
Labels
bug Something isn't working

Comments

@rajarshibhargav
Copy link

rajarshibhargav commented Apr 8, 2024

Reporting an Issue or Missing Feature

Please confirm what it is that your reporting

Get-PnPTenantSite command does not return any output if the number of sites is greater than 40k

Expected behavior

Please describe what output you expect to see from the PnP PowerShell Cmdlets

Get-PnPTenantSite command should return the correct output even if the number of sites is greater than 40k

Actual behavior

Please describe what you see instead. Please provide samples of output or screenshots.

Get-PnPTenantSite command does not return any output if the number of sites is greater than 40k . We waited close to 20 minutes in order to get an output for this command but we did not get any response. We also want to know if there is any fixed interval that we need to wait for a response under Get-PnPTenantSite command while running it for an organisation having greater than 40k Sharepoint Sites.

Steps to reproduce behavior

Please include complete script or code samples in-line or linked from gists

Run Get-PnPTenantSite command for any organisation which has more than 40k Sharepoint sites.

What is the version of the Cmdlet module you are running?

(you can retrieve this by executing Get-Module -Name "PnP.PowerShell" -ListAvailable)

PS /app> Get-Module -Name "PnP.PowerShell" -ListAvailable

Directory: /home/spm/.local/share/powershell/Modules

ModuleType Version PreRelease Name PSEdition ExportedCommands


Manifest 2.2.0 PnP.PowerShell Desk {Add-PnPAdaptiveScopeProperty, Add-PnPPropertyBagValue, Add-PnPSiteClassification, Copy-PnPFolder…}

Which operating system/environment are you running PnP PowerShell on?

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify
@rajarshibhargav rajarshibhargav added the bug Something isn't working label Apr 8, 2024
@jackpoz
Copy link
Contributor

jackpoz commented Apr 9, 2024

Did you store the result in a variable like $result = Get-PnPTenantSite or did you call the command like Get-PnPTenantSite ?
Note that the latest version is 2.4.0, try updating it.

@rajarshibhargav
Copy link
Author

We dont store the result in a variable like $result = Get-PnPTenantSite. However we redirect the command output to json like | ConvertTo-Json -Compress -Depth

@rajarshibhargav
Copy link
Author

Hi @jackpoz We have updated the version to 2.4.0, however we are still facing the same issue. Request you to kindly look into this issue and help us with a solution / workaround here.

@jackpoz
Copy link
Contributor

jackpoz commented Apr 19, 2024

I do remember having no issues in a tenant with 300k site collections but I don't have access to that tenant anymore.
Does the command get stuck still as you said you waited 20 minutes ?

@rajarshibhargav
Copy link
Author

Yes @jackpoz . From my testing I was able to get 40k Sites after waiting ~ 2 minutes. For organisation with > 40 k sites, I waited beyond 2 minutes (upto 20 minutes) but the command Get-PnPTenantSite never returned anything.

@rajarshibhargav
Copy link
Author

May i request an update on the bug fix here?

@rajarshibhargav
Copy link
Author

Hi @jackpoz

We have observed that the command Get-PnPTenantSite returns the output even if the number of sites is greater than 40k. This might be likely because this command just returns the names of sharepoint sites.

However if we run the command as in Get-PnPTenantSite | ConvertTo-Json -Compress -Depth to get the site attributes, we dont get any output if the organisation has more than 40k sites.

Hope this helps us to identify the root cause here.

@jackpoz
Copy link
Contributor

jackpoz commented May 22, 2024

Please try this:

$sites = Get-PnPTenantSite
$sites.Count

If that shows the correct count, then it's not a PnP PowerShell issue.
I would suggest to export the result to csv using Export-Csv as a different way to save the result.

Interestingly enough, it seems ConvertTo-Json has some max size limit inherited from .NET, see https://stackoverflow.com/questions/16854057/convertfrom-json-max-length as old example.

@rajarshibhargav
Copy link
Author

Thank you @jackpoz . Export-Csv has solved this issue.

@ns-khp
Copy link

ns-khp commented May 23, 2024

Cannot thank you enough @jackpoz . That answer was super helpful 🙏 🙏 .

@jackpoz
Copy link
Contributor

jackpoz commented May 23, 2024

Thank you too, I learnt something new about ConvertTo-Json 👍

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

No branches or pull requests

3 participants