Remove-Site
SharePoint Online: Sends a site collection to the recycle bin
#Requires -Version 5.1
#Requires -Modules Microsoft.Online.SharePoint.PowerShell
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[string]$Identity,
[switch]$NoWait
)
Process {
try {
$cmdArgs = @{ ErrorAction = 'Stop'; Identity = $Identity; NoWait = $NoWait; Confirm = $false }
Remove-SPOSite @cmdArgs | Out-Null
[PSCustomObject]@{ Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"; Status = "Success"; Message = "Site '$Identity' sent to recycle bin" }
}
catch { throw }
}URL of the site collection to remove
Off
Continue executing script immediately without waiting