Skip to content

Instantly share code, notes, and snippets.

@kasuken
Last active June 19, 2019 09:49
Show Gist options
  • Save kasuken/cd682973421bb68aa780c00c6f4cc3a3 to your computer and use it in GitHub Desktop.
Save kasuken/cd682973421bb68aa780c00c6f4cc3a3 to your computer and use it in GitHub Desktop.
Powershell script to remove an SPOsite (from the recycle bin, as well)
$username = ""
$password = ""
$Password = ConvertTo-SecureString -String $password -AsPlainText -Force;
$Credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
Connect-SPOService -Url "https://[tenant]-admin.sharepoint.com" -Credential $Credentials
Get-SPODeletedSite | Remove-SPODeletedSite
$username = ""
$password = ""
$webUrlToDelete = "[urlToDelete]";
$Password = ConvertTo-SecureString -String $password -AsPlainText -Force;
$Credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
Connect-SPOService -Url "https://[tenant]-admin.sharepoint.com" -Credential $Credentials
Remove-SPOSite -Identity $webUrlToDelete -NoWait
Remove-SPODeletedSite -Identity $webUrlToDelete -NoWait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment