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

[玩转系统] 如何使用 PowerShell 更改 SharePoint 网站徽标?

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

如何使用 PowerShell 更改 SharePoint 网站徽标?


我们可以通过从 SharePoint Web 用户界面转到:站点设置>>“标题、描述和徽标”来更改 SharePoint 2013 站点徽标:

[玩转系统] 如何使用 PowerShell 更改 SharePoint 网站徽标?

现在,让我们通过 PowerShell 更改网站集中所有网站的徽标以节省时间。

SharePoint 2013 使用 PowerShell 以编程方式更改网站徽标:


Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

#Web URL to update Logo 
$WebURL = "https://sharepoint.crescent.com/sites/operations/us/"

#Get the Web
$Web = Get-SPWeb $WebURL

$web.SiteLogoUrl = "/_layouts/15/images/sharepoint-diary-logo.png"  #can be from any library too: "/sites/operations/images/Corp-Logo.png"
$web.Update()

Write-host "Logo updated for :"$WebURL

此脚本以编程方式更改单个站点的徽标。

您可以将徽标文件复制到每个 WFE,以从文件系统而不是从 SharePoint 库检索徽标。 “Images”虚拟文件夹与文件系统中的“C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\IMAGES”映射。

确保每个人都可以访问您的徽标文件。用户至少必须具有读取权限!并且应该获得批准(如果内容批准已开启。也已签入并发布!)。否则,您的用户在访问 SharePoint 网站时可能会收到持续的身份验证提示,而不会加载页面!

使用 PowerShell 更新 SharePoint 网站集的徽标 URL:


Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

$SiteURL = "https://Your-Site-Collection-URL"

#Get the site collection
$Site = Get-SPSite $SiteURL

#Iterate through each site in the site collection 
foreach($web in $Site.AllWebs)
{   
    #sharepoint change logo programmatically 
    $web.SiteLogoUrl = "/relative-path-logo-file" 
    $web.Update()
} 

此脚本更改 SharePoint 2010(或 SharePoint 2013)中所有网站的徽标。

[玩转系统] 如何使用 PowerShell 更改 SharePoint 网站徽标?

SharePoint PowerShell 更改 Web 应用程序中所有网站的网站徽标:

让我们简单地更改整个 Web 应用程序的徽标:


#sharepoint 2016/2013 change logo for all sites 

Get-SPWebApplication "https://sharepoint.crescent.com" | Get-SPSite -Limit "All" | Get-SPWeb -Limit "All" |  foreach { $_.SiteLogoUrl=""; $_.update(); Write-host "Changing Logo for:"$_.Url;  }

所有这些脚本也对 SharePoint 2010 有效!

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

取消回复欢迎 发表评论:

关灯