Forum Discussion

pshankland's avatar
pshankland
Copper Contributor
Oct 21, 2021

Progress of Remove-PnPListItem?

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}

 

  • Taypos's avatar
    Taypos
    Copper Contributor
    Hello pshankland,
    Did you manage to get this working?
  • _RBL_'s avatar
    _RBL_
    Brass Contributor

    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

Resources