当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 使用 PowerShell 从 SharePoint 2013 中的网站删除主题

作者:精品下载站 日期:2024-12-14 13:48:38 浏览:13 分类:玩电脑

使用 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 来删除主题。

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯