使用 PowerShell 从 SharePoint 2013 中的网站删除主题
要求:为了强制一致性,我们希望重置 SharePoint 环境中的最终用户在 SharePoint 网站上应用的自定义主题。
如何使用 PowerShell 删除 SharePoint 中的主题?
以下是如何使用 PowerShell 以编程方式从 SharePoint 中删除主题:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Variable
$WebAppURL = "https://intranet.crescent.com"
Get-SPWebApplication $WebAppURL | Get-SPSite -Limit ALL | Get-SPWeb | ForEach-Object {
#remove theme sharepoint 2013
$Theme = [Microsoft.SharePoint.Utilities.ThmxTheme]::RemoveThemeFromWeb($Web,$false)
$Web.Update()
}
Write-host "Themes are removed from all sites!"
这将删除并重置为默认 SharePoint 主题。相同的脚本也适用于 SharePoint 2010 来删除主题。