Permanently Delete a SharePoint Site

To permanently delete a sharepoint site, you need to use powershell. In my case, I had two site colections which I’ve created, but even if I removed them from sharepoint admin center, it moves to reclye bin, but until expiration of this service, I just have 4 days, so ast to remove permanenlty sharepoint site, I have to use sharepoint site with no wait.                If you go to sharepoint admin center, then remove a site, it moves to recyle bin with 30days. OnlineManagementShell.png

It needs to install SharePoint Online Management Shell, then needs to connect online sharepoint using powershell, later I’ll remove shrepoint site with no-wait option.

# Set password to encrypted value as specific txt file
Read-Host -Prompt “Enter password to be encrypted in mypassword.txt” -AsSecureString | ConvertFrom-SecureString | out-file “D:\O365securestring_test.txt”
# Get value from encrypted value from txt file
$password = cat “D:\O365securestring_test.txt” | ConvertTo-SecureString
$upn = “my upn address”
$mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist $upn,$password
# Import SharePoint Module
Import-Module “C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell”
#Connect to SharePoint Online
Connect-SPOService -URL “https://cloudwide1602-admin.sharepoint.com” -Credential $O365Cred

SharePoint_Online_Management_Shell_Prmpt then it pops up Microsoft SharePoint Online Management Shell page, then I added my upn and password, the reason why that pop-up as authentication is , I’m not using “SharePoint Online management shell”, so it pop-up

It needs to check with current site collection using “Get-SPOSite“, and if you use “Get-SPODeletedSite” cmdlet, it returns  “Returns all deleted site collections from the Reclye Bin“, I have to remove this site collection from recyle-bin, how can I do it?SPODeleteSite.png  In this case , I can use Remove-SPODeletedSite which can do function as “Remove a SharePoint Online deleted site collection from the Recycle Bin“, ex) Remove-SPODeletedSite -Identity https://cloudwide1602.sharepoint.com/sites/Teamsite , If I do exectue that command, then I try  Get-SPODeletedSite to verify the site which I want to delete is existed or not, there is no site from Recyle bin.

Or, If you want to permanently delete a sharepoint site collection, you need to use          Remove-SPOSite -Identity “Site Collection to delete” -NoWait        Confirm_RemoveSPOSite.png                                    Start-Sleep -s 20      [Pause script for 20 seconds before proceeding]                                                                                                                                         Remove-SPODeletedSite  -Identity “Site Collection to delete” Confirm_spodeletesite.png

In the Remove-SPOSite cmdlet have a NoWiat Parameter, it directs “specifies to continue executing script immediately”

Advertisements

글쓴이: hongwoo jin

I'm managing our Korea company's Office 365 administrator I want to be MS Office 365 & SharePoint MVP with certification.

답글 남기기

아래 항목을 채우거나 오른쪽 아이콘 중 하나를 클릭하여 로그 인 하세요:

WordPress.com 로고

WordPress.com의 계정을 사용하여 댓글을 남깁니다. 로그아웃 / 변경 )

Twitter 사진

Twitter의 계정을 사용하여 댓글을 남깁니다. 로그아웃 / 변경 )

Facebook 사진

Facebook의 계정을 사용하여 댓글을 남깁니다. 로그아웃 / 변경 )

Google+ photo

Google+의 계정을 사용하여 댓글을 남깁니다. 로그아웃 / 변경 )

%s에 연결하는 중