Saturday 5 November 2016

Delete Site/site collections in bulk

Today I am providing the Power Shell Script that will delete multiple sites/site collections from the given list. List will be provided in the form of a csv file. The columns in csv file will be siteurl, type. Here in type, Provide s if given url is for sub site or sc for site collection.

.Inputs
Path - Provide csv file with path that will be used as input for this script.

.Outputs
Sites will be deleted as per the list in csv file.

Example-
.\scriptname.ps1
.\scriptname.ps1 | out-file “FilePath\Filename.txt”

Dependencies –
For executing this script user must be added in site collection administrators in the sites.
User should have Shell Admin rights to run the scripts.
Run Management Shell as an Administrator.
How to execute -
Copy this script and paste in Note pad.
Save this file as .ps1.
Run this script in SharePoint Management Shell. You can run this script in PowerShell as well.
Follow on screen instructions.

FOR ANY HELP ON THIS SCRIPT USE "GET-HELP .\SCRIPTNAME.PS1 --FULL" AFTER SAVING THIS FILE.


Go to above link to get the script.
Csv template link –




No comments:

Post a Comment