In this post, we will discuss how we can delete list items using PowerShell in SharePoint 2013. The same PowerShell script we can use to delete list items in SharePoint 2016. We can write PowerShell script in Windows PowerShell ISE or you can use Visual studio code to write, debug and test PowerShell scripts.
Below is the PowerShell script. Open SharePoint 2013 Management Shell and run below PowerShell command.
I have a list name as “MyTestList99” which has below items. I want to delete all items using PowerShell.
$web = Get-SPweb “http://win-pfcp2dgt8di/sites/EnjoySharePoint/”
$list = $web.Lists[“MyTestList99”]
$items = $list.items
foreach ($item in $items)
After running above command, if you will refresh the list, you will not get any item in the list.
Read some SharePoint PowerShell tutorials:
- Increase SharePoint Online Storage Quota using PowerShell
- E-mail notification using PowerShell script in Office 365
- Create web application in SharePoint 2016 from Central Administration and using PowerShell
- Bulk SharePoint Online Site Collection Creation using PowerShell
- GridView in PowerShell in SharePoint
Hope this will be helpful.
You May Also like the Following SharePoint Tutorials: