Forum Discussion
Best way to run Get-PNPRecycleBInItems against multiple OneDrives and with 2FA
Hi
I have been asked to audit the retention policies applied to bunch of test user's ODFB document libraries. Hence, looking to review the recycle bins of each user ( I think the primary bin is scoped to the site and the secondary is at the site collection level) .
with this in mind I am currently using the snippet below, in that I am trying to get around the issue when my first 2FA connection goes through ok but subsequent connections fail because I presented with a nice blank 2FA dialog and VSCode just freezes. Indeed I end up having to to restart the PS session in VSCode. If there is a better way to parse these recycle bins, I am all ears!
$retnConnection = $null
foreach($auditItem in $auditItems)
{
Write-Host $auditItem.SiteName " " $auditItem.SiteUrl
$ODFBDocumentLibaryUrl = $ODFBBaseUrl + $auditItem.DocumentLibaryUrl
Write-Host -ForegroundColor DarkYellow $ODFBDocumentLibraryUrl
If ($retnConnection)
{
Disconnect-PnPOnline
}
# connect to the user's ODFB
$retnConnection = Connect-PnPOnline -Url $auditItem.SiteUrl -UseWebLogin -ReturnConnection
Get-PnPRecycleBinItem -SecondStage | Select-object -First 100 Title, DirName, DeletedByName, DeletedDate, DeletedDateLocalFormatted
}
- AnonymousJul 13, 2019What happens if you add -ClearTokenCache -SPOManagementShell after -UseWebLogin?
Does it progress further than the blank screen?
4 Replies
- AnonymousWhat happens if you add -ClearTokenCache -SPOManagementShell after -UseWebLogin?
Does it progress further than the blank screen?- Daniel WesterdaleIron Contributor
Deleted Thanks for your response. I have always wondered about these additional parameters. Will try this first thing on Monday and report back. BTW for reference, this the " white screen of death" I have been encountering.
- AnonymousNo problem at all, it sounds like this issue which a few others have come up against.
https://github.com/SharePoint/PnP-PowerShell/issues/1744