SharePoint Delete Items and files directly or using recycle bin by using Powershell

Powershell Script

When you use a Powershell Script to work on SharePoint List items or Files you can do a lot of things. One of those things for example is deleting items which are not needed anymore. Therefore you can use a Powershell function like


This means that the list item or file will be deleted permanently. It will not be in the SharePoint recycle bin and not in the secondary recycle bin. It is lost forever if you not have it in one of your backups.

So what if, if you would like to delete it, but put it into the recycle bin? Therefore you should not use the delete() function. In this case you should use the following


This will put the item into the secondary recycle bin SharePoint offers. You can reach this one if you click on site settings and then below Site Collection Administration the link to the recycle bin



Normally this recycle bin will be emptied after a certain period which can be configured in the central administration.

One of my questions is now – Can we put those files also into the first recycle bin for the enduser? If you know it, please let me know.

In this post there is a little explaination based on SharePoint 2007.

The article or information provided here represents completely my own personal view & thought. It is recommended to test the content or scripts of the site in the lab, before making use in the production environment & use it completely at your own risk. The articles, scripts, suggestions or tricks published on the site are provided AS-IS with no warranties or guarantees and confers no rights.

About Karsten Schneider 312 Articles
Consultant for Microsoft 365 Applications with a strong focus in Teams, SharePoint Online, OneDrive for Business as well as PowerPlatform with PowerApps, Flow and PowerBI. I provide Workshops for Governance & Security in Office 365 and Development of Solutions in the area of Collaboration and Teamwork based on Microsoft 365 and Azure Cloud Solutions. In his free time he tries to collect tipps and worthy experience in this blog.

Be the first to comment

Leave a Reply

Your email address will not be published.