How to delete all items in a list (using Powershell)

This week, I needed to find a way to efficiently delete all items in a SharePoint list, with the least amount of customization and development effort. I found some code on the Internet (such as here). You can also use SP Designer, or download a custom webpart called SPPurgeList (see here).

Well, I wanted to do it via Powershell (for a number of reasons). Here’s the code that I came up with (and which works on my farm).

This Powershell script iterates through and deletes all items in the specified list.