0

I am getting all external users for the site collection using below pnp powershell. It runs perfectly for some site collections.

$connection =  Connect-PnPOnline -Url $siteurl -Tenant $TenantID -ClientId $AppID -Thumbprint $Thumbprint -ReturnConnection -WarningAction SilentlyContinue  
write-output "Established connection "  

$ctx = Get-PnPContext
$allusers =  Get-PnPUser -Connection $connection  | Where{$_.LoginName -like "_*#ext#*" -or $.LoginName -like "*urn:spo:guest*"}

But, I need to iterate over 600 000 site collections and for that I am calling 25 instances of the runbook at a time. On doing so, for some site collections , it gives below error

The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested

on the get-pnpuser line and sometime during creating connection. Not sure what is causing this.

Error

  • Please use universal measurements instead of local words like *lakh*. Not everyone understands them. – James Z May 02 '23 at 12:54

0 Answers0