A truncate would really help cause for each delete loop will take for ever. I am trying to delete 500k records and it's very slow. It's taking 3 minutes to delete 1 record.
# Delete items from a list
if((Get-PSSnapin | Where {$_.Name -eq “Microsoft.SharePoint.PowerShell”}) -eq $null)
{
Add-PSSnapin Microsoft.SharePoint.PowerShell
}
$web = Get-SPWeb http://portal.logix.com/billing
# IMPORTANT - LIST NAME IS DIPLAY NAME NOT INTERNAL NAME
$list=$web.Lists["Sales Tickets"]
$listItems = $list.Items
$listItemsTotal = $listItems.Count
for ($x=$listItemsTotal-1;$x -ge 0; $x--)
{
# USE THIS IF YOU HAVE CONDITION
#if($listItems[$x].name.Contains("3"))
#{
Write-Host("DELETED: " + $listItems[$x].name)
$listItems[$x].Delete()
#}
}
$web.Dispose()