May 20, 2013

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 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!

NOTE. GEMYSITELOCKDOWN is FREE. You should ensure that you test this tool on your test servers BEFORE using them, and ensure that you read CAREFULLY the instructions given below. Download links are are the foot of this article. A huge amount of work has gone into the creation of this tool, so, if you find it useful, please DONATE

Steps:

1: Download this tool (See DOWNLOAD at the foot of this article). Unzip it and put it on your sharepoint server, get to a command prompt – note stsadm.exe should be on the path!

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

etc

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”

etc

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!

Download

This tool, as said, is Free. However, a huge amount of work goes into building this and other tools available on my site. If you find this tool useful (or in fact any of them), then please Donate.

Download GEMYSITELOCKDOWN from here: GEMYSITELOCKDOWN

You May Also Like…