Was asked today – is there anyway to remove Mysites en-mass in SharePoint 2010?

Yes, because I’ve written a free tool available for download on CodePlex that works using the following parameters:

-a  Create file for ALL sites within the chosen collection
-d  Create file for sites within the chosen collection that have been modified in the last day.
-w Create file for sites within the chosen collection that have been modified in the last week.
-n  Lock State is None
-x  Lock State is NoAdditions
-y  Lock State is ReadOnly
-z  Lock State is NoAccess
-u  URL of the Site Collection whose subsites you want to lockdown

For DELETING MySites, here’s a scenario for you to consider:

You have released mysites onto a test platform for users to have a play; now you would like them to start again, maybe with a different brand, format that you’re working on. So, you would like to delete their Mysites. Only problem is, you may not want to delete all of them, or you may only want to delete the ones modified yesterday, or maybe even last week?

Hey don’t let the title GEMySiteLockDown scare you, and ok, it sounds like its going to lock your mysites instead of deleting them – no its not. Because this tool creates a batch file with the relevant stsadm commands in them – so, all you need to do is to carry out a slight modification.

By the way, this is a quick fix around the issue, am going to modify this command so it creates a batch file to DELETE mysites instead of locking them – anyway, read on!


1: Download this tool from Codeplex: http://gemysitelockdown.codeplex.com/ Unzip it and put it on your sharepoint server, get to a command prompt – note stsadm.exe should be on the path!

2: Run the tool to create the batch file to list all mysites:

GEMySiteLockDown -a -n -u http://mysite

3: That will create a batch file called MySiteLockDown.Bat

4: Open the batch file and you will see lines like this:

stsadm -o setsitelock -url “http://mysite/personal/bdavies” -lock none
stsadm -o setsitelock -url “http://mysite/personal/jbloggs” -lock none


5: Remove all -lock none (simple search and replace -lock none with a blank)

6: Search and Replace all setsitelock with deletesite

7: All the lines will now look like this:

stsadm -o deletesite -url “http://mysite/personal/bdavies” stsadm -o deletesite -url “http://mysite/personal/jbloggs”


Now save the batch file as DeleteMySites.Bat

Exit notepad and run it – voila – a stsadm version of deleting all mysites in one fell swoop!