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.
Download FREE SharePoint 2019 Installation PDF Guide
This FREE PDF contains, Steps by step guide to install SharePoint 2019 Preview, prerequisites, hardware and software new features. First impression to SharePoint Server 2019 new modern site, modern lists and modern document libraries.
You May Also like the Following SharePoint Online Tutorials: