Friday, February 13, 2015

SharePoint Online: PowerShell to Delete Site Collection

How to delete a SharePoint Online Site collection using PowerShell?

Import-Module Microsoft.Online.Sharepoint.PowerShell

#Variables for processing
$AdminSiteURL = ""
$AdminName = ""
$SiteCollURL = ""

#Credentials to connect 
$SecurePWD = ConvertTo-SecureString "Password" –asplaintext –force  
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $AdminName, $SecurePWD
#Connect to SharePoint Online
Connect-SPOService -url $AdminSiteURL -credential $Credential

#Delete SharePoint Online Site Collection
Remove-SPOSite -Identity $SiteCollURL -NoWait -Confirm:$false

Write-Host "Site collection has been deleted!"

Permanently Delete the SharePoint Online Site Collection:
When you delete a site collection, it goes to recycle bin. You may want to permanently delete that site collection to reuse the storage space or recreate a new site collection with the same URL.
SharePoint Online PowerShell to Delete Site Collection
#Remove Deleted SharePoint Online Site Collection permanently
Remove-SPODeletedSite –identity $DeletedSiteCollURL -Confirm:$false

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...