Progress of Remove-PnPListItem?

Copper Contributor

Hi, I am using the following to delete a large SharePoint Online list (200k items) and was wondering if there was a way I could add something to show the progress through the list? Something like "completed x of x" Any thoughts? Thanks.

 

 

Get-PnPListItem -List $listName -PageSize 500 -ScriptBlock {Param($items)} | ForEach-Object {Remove-PnPListItem -List $listName -Identity $_.Id -Force}

 

2 Replies

@pshankland 

for($I = 1; $I -lt 101; $I++ )
{
    Write-Progress -Activity Updating -Status 'Progress->' -PercentComplete $I -CurrentOperation OuterLoop
    for($j = 1; $j -lt 101; $j++ )
    {
        Write-Progress -Id 1 -Activity Updating -Status 'Progress' -PercentComplete $j -CurrentOperation InnerLoop
    }
}


Updating
Progress ->
 [ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo]
OuterLoop
Updating
Progress
 [oooooooooooooooooo                                                   ]
InnerLoop

 Write-Progress (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Docs

Hello pshankland,
Did you manage to get this working?