Remove-SPSite
Published: July 16, 2012
Applies to: SharePoint Foundation 2013 | SharePoint Server 2013 Enterprise
Completely deletes an existing site collection and all subsites.
Remove-SPSite [-Identity] <SPSitePipeBind> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-DeleteADAccounts <SwitchParameter>] [-GradualDelete <SwitchParameter>] [-WhatIf [<SwitchParameter>]]
Parameters
| Parameter | Required | Type | Description | ||
|---|---|---|---|---|---|
| Identity | Required | Microsoft.SharePoint.PowerShell.SPSitePipeBind | Specifies the identity of the site to delete. The identity can be either a valid URL, in the form http://server_name; a valid GUID, in the form 12345678-90ab-cdef-1234-567890bcdefgh; or an SPSite object. | ||
| AssignmentCollection | Optional | Microsoft.SharePoint.PowerShell.SPAssignmentCollection | Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.
| ||
| Confirm | Optional | System.Management.Automation.SwitchParameter | Prompts you for confirmation before executing the command. For more information, type the following command: get-help about_commonparameters | ||
| DeleteADAccounts | Optional | System.Management.Automation.SwitchParameter | Forces deletion of user accounts from Active Directory Domain Services (AD DS). This applies when in AD DS account creation mode and the value of this parameter is True, AD DS accounts associated with the site collection are also deleted from AD DS. | ||
| GradualDelete | Optional | System.Management.Automation.SwitchParameter | If provided, occurs gradually to use less system load. This operation is strongly recommended for deleting very large sites. | ||
| WhatIf | Optional | System.Management.Automation.SwitchParameter | Displays a message that describes the effect of the command instead of executing the command. For more information, type the following command: get-help about_commonparameters |
Detailed Description
The Remove-SPSite cmdlet completely deletes an existing site collection and all subsites. This operation cannot be undone.
Input Types
Return Types
------------------EXAMPLE-----------------------
Remove-SPSite –Identity "http://sitename" –GradualDelete –Confirm:$False
This example removes the given site collection and all included sites by using GradualDelete; confirmation has been suppressed.
Change History
| Date | Description |
|---|---|
| July 16, 2012 | Initial publication |

Note: