On SharePoint 2013 I'm trying to delete a site collection programmatically and send it to the Recycle Bin. Through the interface is no problem, it goes straight to the Recycle Bin, but when it comes to PowerShell,
Remove-SPSite
doesn't have a-Recycle
parameter, so the site collection doesn't go to the Recycle Bin.Remove-SPWeb
has this parameter, but this cmdlet doesn't let me use it becauseCannot put top-level site into Recycle Bin
.
What am I doing wrong? Is there any way to achieve this?
Thanks.
Edit: I forgot to say that a C# solution is also valid, even preferable.
Remove-SPDeletedSite
Remove-SPSite
it doesn't appear on the Recycle Bin withGet-SPDeletedSite
.