Search code examples
powershellsharepointsharepoint-2010

Deleting Sharepoint Site Using PowerShell


I am trying to delete a sharepoint site using powershell:

Remove-SPSite -Identity "site url"

I keep receiving an error message:

"Cannot find an SPSite object with Id or Url"

I am using sharepoint powershell on the sharepoint server using a farm user. I don't get anything when I run $StackTrace after the command. Thank you


Solution

  • Upon seeing your response to Guruparan's question, if you are trying to delete a subsite you need to use a different commandlet

    Remove-SPWeb http://yourwebapp.example.com/sites/yoursite/yoursubsite
    

    Reference: https://technet.microsoft.com/en-us/library/ff607890.aspx