How to delete a SharePoint Site in SharePoint Online using Powershell?

Hello SharePointers,

Below is the Powershell command to delete a SharePoint site in Online/Office 365 using Powershell

Add-Type -Path “c:\folder\Microsoft.SharePoint.Client.dll”

Add-Type -Path “c:\folder\Microsoft.SharePoint.Client.Runtime.dll”

$siteUrl = “”

$password = Read-Host -Prompt “Enter password” -AsSecureString

$context = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)

$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials(“”, $password)

$context.Credentials = $credentials

$web = $context.Web





Write-Host $web.Title “Site Deleted”


Happy Sharepointing!!

Leave a Reply

Your email address will not be published. Required fields are marked *