locked
Powershell - Show all locked sites RRS feed

  • Question

  • Hello

    I have run into an issue where I have found 2 of my 135 site collections set to lock (read only) this morning.  I have seen this in the past where during the nightly backups, the site collection lock is not released.  I really do not want to go through the hoops of checking each one in CA (it would take an hour or more to do).

    What I am looking for is a quick powershell script that can show me those sites that are locked/readonly.  (Is there a way to do that in Powershell?  Sorry I am very new to Powershell.)

    thank you for your thoughts

    Rob C


    Rob C
    Thursday, August 18, 2011 5:19 PM

Answers

  • Hi Rob,

    The equivalent of the stsadm command Getsitelock is Get-SPSiteAdministration, as per this site: http://technet.microsoft.com/en-us/library/ff621084.aspx. It looks like you could write a sccript to go through site and set each to unlocked.

    Doing this however, would just patch the issue. The actual problem appears to be this -- Something is wrong with 2 of your site collection backups. Most likely they aren't finishing, so the lock isn't released. If you need to restore them one day, your backups may not be usable. I'd suggest checking the logs to find the actual problem. (Maybei t's a space issue on your backup media? Could be several reasons for it.. ) If the underlying problem is fixed, your locking issue should go away.

    Hope this helps,

    K. Ryan

     


    Kim Ryan, SharePoint Consultant kim.ryan@[no spam]pa-tech.com
    Monday, August 22, 2011 11:44 AM

All replies

  • Hi Rob,

    Are you using Backup_spSite cmdlet?

    If the above is true and your SQL is Enterprise/ Developer edition - you should use 'UseSQLSnapShot' switch with your Backup-SpSite command. This would ensure no locks happen in the first place and is recommanded.

    Hope this helps!

     


    BlueSky2010

    • Edited by BlueSky2010 Friday, August 19, 2011 4:29 PM added link
    Friday, August 19, 2011 4:28 PM
  • Hi Rob,

    The equivalent of the stsadm command Getsitelock is Get-SPSiteAdministration, as per this site: http://technet.microsoft.com/en-us/library/ff621084.aspx. It looks like you could write a sccript to go through site and set each to unlocked.

    Doing this however, would just patch the issue. The actual problem appears to be this -- Something is wrong with 2 of your site collection backups. Most likely they aren't finishing, so the lock isn't released. If you need to restore them one day, your backups may not be usable. I'd suggest checking the logs to find the actual problem. (Maybei t's a space issue on your backup media? Could be several reasons for it.. ) If the underlying problem is fixed, your locking issue should go away.

    Hope this helps,

    K. Ryan

     


    Kim Ryan, SharePoint Consultant kim.ryan@[no spam]pa-tech.com
    Monday, August 22, 2011 11:44 AM