Following on from a post / script I created a year or so ago to bulk create project sites, there have been requests to be able to bulk delete projects sites. I have been reluctant to do that as i am always cautious when “bulk” deleting! The script i have created reads the list of projects from a text file so that the user running the script knows exactly what project sites they are going to be delete. The script can be downloaded from the Microsoft Script gallery below:

The text file will need to be created with a list of projects names from your PWA instance – ONLY INCLUDE project names for the project sites you want to delete – all site data (lists, documents etc.) will be deleted as the site will be deleted! The only scenario I would really use a script like this is if I wanted to delete all of my project sites, if I only needed to remove a handful I would do it manually via the UI. The example text file can be seen below:

Update the location of the text file and text file name for the Get-Content command.

The web service proxy URLs will need to be updated for your PWA instance, replace the http://vm753/pwa with the correct URL.

The script can be seen running and deleting sites below:

From the PowerShell ISE:

All data from the project sites will be lost so please use this with care and only enter project names in the text file for projects sites and project site data you no longer need.

Run the script with a PWA administrator account.

Fully test this script on a test / non-production PWA instance before running on any production environment. As a precaution, take full database backups (PWA and SharePoint Content) before running the script on the production environment so that you can roll back if needed.