繁体   English   中英

删除 SharePoint 在线站点 collections 使用 powershell

[英]Delete SharePoint Online site collections using powershell

我一直在尝试从 csv 中删除站点 collections,我正在尝试使用 powershell 脚本来获取要删除的站点 URL。

我已经尝试了一切,现在我已经没有想法了,我正在打开这个问题。 我接受 Powershell 以外的可能性

PS:我试图在不在租户中创建任何东西的情况下执行此操作。

此站点属于 Microsoft 365 组。 要删除该站点,您必须删除该组。

在此处输入图像描述

下面是一些尝试:

 #Modules
 Import-Module ExchangeOnlineManagement
 Import-Module Microsoft.Online.SharePoint.PowerShell
 Import-Module SharePointPnPPowerShellOnline
        
 $site = "https://tenant.sharepoint.com/sites/site"
 $mailGroup = "group@onmicrosoft.com"
        
 #First
 Remove-UnifiedGroup -Identity $mailGroup-Confirm:$false
 Remove-SPOSite -Identity $site -NoWait -Confirm:$false
        
 #Second
 Remove-UnifiedGroup -Identity $mailGroup-Confirm:$false
        
 Set-SPOSite -Identity $site  -LockState "unlock" 
 Set-SPOSite -Identity $site  -Owner $userCredential.UserName
 Remove-SPOSite -Identity $site -NoWait -Confirm:$false
        
 #Third
 $SharepointSite = Get-SPOSite $site
 Remove-PnPUnifiedGroup -Identity $SharepointSite .GroupID
 Remove-PnPTenantSite $site

我还尝试了链接中的内容: https://learn.microsoft.com/en-us/answers/questions/674248/batch-delete-site-collections-in-powershell-from-c.html

在运行Remove-SPOSite -Identity $site -NoWait -Confirm:$false之前,请尝试运行命令Remove-UnifiedGroup -Identity "group name"以删除 Microsoft 365 组。 注意:删除群组后可能需要等待一段时间,站点才能成功删除。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM