PowerShell - 删除/删除特定托管路径下的所有网站集
-
29-09-2020 - |
题
我为我的团队站点创建了一个托管路径 - 称为“工作区”。所有团队站点都已在同一托管路径下创建。
ex:
http://awesome.com/workspaces/teamsite1
http://awesome.com/workspaces/teamsite2
.
如何在托管路径下列出所有团队站点?
我想要的是删除特定托管路径下的所有网站集。(删除网站集和db-intent)
解决方案
要列出它们,这实际上为您提供了路径下的所有网站:
Get-SPSite "http://awesome.com/workspaces*" -Limit ALL
.
要删除,您应该能够使用
Get-SPSite "http://awesome.com/workspaces*" -Limit ALL | Remove-SPSite -Confirm:$false
.
可以使用
Remove-SPContentDatabase -Identity {GUID}
.
要删除内容数据库
其他提示
您可以使用以下命令使用PowerShell删除网站集合
$tmpRoot = Get-SPWebApplication -Identity http://SP:2000
$tmpRootColl=$tmpRoot.Sites
#Enumerate through each site collection
for ($index=$tmpRootColl.Count-1 ; $index-ge 0 ; $index–-)
{
Remove-SPSite -Identity $tmpRootColl.Item($index) -GradualDelete -Confirm:$false
}
Get-SPDeletedSite | Remove-SPDeletedSite
.
其中 $ tmproot 是web应用程序, $ tmprootcoll 是Web应用程序下的站点集合
查找此博客 codeplayandlearn