locked
How to manually Delete dead sites (personal or mysite's) RRS feed

  • Question

  • Hi team,

    Thank you for taking time to answer this question

    We have farm with huge number of personal sites and we have enabled Auto site clean up job due to corporate policy. Now we feel these dead sites must be taking too much of disk space and want to remove. What is the best option without enabling 'Auto site clean up job'

    Regards,
    Ram


    Ramakrishna Pulipati SharePoint Consultant Logica Bangalore, INDIA
    Thursday, March 24, 2011 10:53 AM

Answers

  • The STSADM operation Stephen mentioned is useful, but I hate to say that I don't think its going to be much help for what you're looking to do. The REPAIRDATABASE operation is good for orphaned items within a content database, but what you're looking for is a way to remove sites that are over a certain age, regardless of whether they're orphaned or not.

    If what you're talking about are site collections (and if by "personal sites" you mean MySites, they definitely each are a site collection), then what you'd want to do is to delete the site collections with STSADM's DELETESITE operation (http://technet.microsoft.com/en-us/library/cc288016%28office.12%29.aspx).(Keep in mind this only works for site collections, not sub sites within a site collection)

    How you choose to implement that operation is kind of up to you, the important thing to do is to create a list of the sites you want to delete and set up an individual call of the operation for each site, passing in the site's URL to the operation as the input. You could go very basic and manually generate the list and create a batch file where each line of the file is a separate call to STSADM for the operation. Or you could create a more in depth (and reuseable) script with PowerShell (definitely try to use PowerShell, its the way of the future for Windows Scripting) or VBscript that would take your list of sites as an input and iterate through them, allowing you to add error checking and make it more flexible for future use. I'd recommend going with the script, but its kind of up to you depending on how much reuse you'll have for it down the road.

    Does that help?

    John


    MCITP and MCTS: SharePoint, Virtualization, Project Server 2007
    My books on Amazon: The SharePoint 2010 Disaster Recovery Guide and The SharePoint 2007 Disaster Recovery Guide.
    My blog: My Central Admin.
    • Marked as answer by Emir Liu Thursday, March 31, 2011 10:51 AM
    Thursday, March 24, 2011 12:57 PM
  • John, thanks for the clarifiaction there, I'd assumed that this could be used for site deletion, as the article mentions it, but having had a more detailed look, I'm leaning towards agreeing with your own asessment.

    In reference to scripting the deletion, I've checked out Gary Lapointe's STSADM commands for orphans, and found this

    http://blog.falchionconsulting.com/index.php/2009/05/new-stsadm-commands-and-parameters-with-sharepoint-2007-sp2/

    In this article, he mentions an update deletesite and enumallwebs commands, which appear to be very useful for the task that Reach Ram has before him.  He also mentions this Technet article, which provides different delete commands for live and orphan sites. http://technet.microsoft.com/en-us/library/cc288016%28office.12%29.aspx

    I don't have time at the moment, but I'll see if I can pull something together later today to test.


    Steven Andrews | SharePoint Professional | http://www.twitter.com/backpackerd00d | https://baron72.wordpress.com/
    • Marked as answer by Emir Liu Thursday, March 31, 2011 10:51 AM
    Thursday, March 24, 2011 1:48 PM
    Answerer

All replies

  • You can use the repairdatabase command within STSADM for this.

    Technet has a useful article here http://technet.microsoft.com/en-us/library/cc263282%28office.12%29.aspx

    Quoting TechNet, this command is often useful for the following items: -

    • A Windows SharePoint Services Web site that does not have a parent Windows SharePoint Services Web site

    • A subweb that does not have a parent Windows SharePoint Services Web site

    • A list that does not have a parent Windows SharePoint Services Web site

    • A document that does not have a parent document library

    • A list item that does not have a parent list

    • A Web page that does not have a parent Windows SharePoint Services Web site

     


    Steven Andrews | SharePoint Professional | http://www.twitter.com/backpackerd00d | https://baron72.wordpress.com/
    • Edited by Steven AndrewsEditor Thursday, March 24, 2011 1:37 PM Clarified my response in light of John's excellent post
    Thursday, March 24, 2011 11:34 AM
    Answerer
  • The STSADM operation Stephen mentioned is useful, but I hate to say that I don't think its going to be much help for what you're looking to do. The REPAIRDATABASE operation is good for orphaned items within a content database, but what you're looking for is a way to remove sites that are over a certain age, regardless of whether they're orphaned or not.

    If what you're talking about are site collections (and if by "personal sites" you mean MySites, they definitely each are a site collection), then what you'd want to do is to delete the site collections with STSADM's DELETESITE operation (http://technet.microsoft.com/en-us/library/cc288016%28office.12%29.aspx).(Keep in mind this only works for site collections, not sub sites within a site collection)

    How you choose to implement that operation is kind of up to you, the important thing to do is to create a list of the sites you want to delete and set up an individual call of the operation for each site, passing in the site's URL to the operation as the input. You could go very basic and manually generate the list and create a batch file where each line of the file is a separate call to STSADM for the operation. Or you could create a more in depth (and reuseable) script with PowerShell (definitely try to use PowerShell, its the way of the future for Windows Scripting) or VBscript that would take your list of sites as an input and iterate through them, allowing you to add error checking and make it more flexible for future use. I'd recommend going with the script, but its kind of up to you depending on how much reuse you'll have for it down the road.

    Does that help?

    John


    MCITP and MCTS: SharePoint, Virtualization, Project Server 2007
    My books on Amazon: The SharePoint 2010 Disaster Recovery Guide and The SharePoint 2007 Disaster Recovery Guide.
    My blog: My Central Admin.
    • Marked as answer by Emir Liu Thursday, March 31, 2011 10:51 AM
    Thursday, March 24, 2011 12:57 PM
  • John, thanks for the clarifiaction there, I'd assumed that this could be used for site deletion, as the article mentions it, but having had a more detailed look, I'm leaning towards agreeing with your own asessment.

    In reference to scripting the deletion, I've checked out Gary Lapointe's STSADM commands for orphans, and found this

    http://blog.falchionconsulting.com/index.php/2009/05/new-stsadm-commands-and-parameters-with-sharepoint-2007-sp2/

    In this article, he mentions an update deletesite and enumallwebs commands, which appear to be very useful for the task that Reach Ram has before him.  He also mentions this Technet article, which provides different delete commands for live and orphan sites. http://technet.microsoft.com/en-us/library/cc288016%28office.12%29.aspx

    I don't have time at the moment, but I'll see if I can pull something together later today to test.


    Steven Andrews | SharePoint Professional | http://www.twitter.com/backpackerd00d | https://baron72.wordpress.com/
    • Marked as answer by Emir Liu Thursday, March 31, 2011 10:51 AM
    Thursday, March 24, 2011 1:48 PM
    Answerer