Powershell管理SharePoint站点

                                               Powershell管理SharePoint站点1


1. 打开SharePoint站点里面的treeview

$spWeb = Get-SPWeb -Identity http://siteurl
$spWeb.TreeViewEnabled = $true
$spWeb.Update()
$spWeb.Dispose()


2. 管理站点Quick Launch

$spWeb = Get-SPWeb -Identity http://siteurl
$spWeb.QuickLaunchEnabled = $true
$spWeb.Update()
$spWeb.Dispose()


3. 添加Top link 

$spWeb = Get-SPWeb -Identity "http://siteurl";

$node = New-Object Microsoft.SharePoint.Navigation.SPNavigationNode $nodeTitle,$NodeUrl, $true;

if ($addAsFirst) {
$spWeb.Navigation.TopNavigationBar.AddAsFirst($node);
} else {
$spWeb.Navigation.TopNavigationBar.AddAsLast($node);
}
$spWeb.Dispose();


4. 取得当前站点的theme

$spWeb = Get-SPWeb -Identity http://nimaintra.net

$theme = [Microsoft.SharePoint.Utilities.ThmxTheme]::GetThemeUrlForWeb($spWeb)

写成方法:

function Get-SPTheme([string]$url) {
$spWeb = Get-SPWeb -Identity $url
$theme = [Microsoft.SharePoint.Utilities.ThmxTheme]::GetThemeUrlForWeb($spWeb)
if (-not([string]::IsNullOrEmpty($theme))) 

{
[Microsoft.SharePoint.Utilities.ThmxTheme]::Open($spWeb.Site, $theme) |
Format-List -Property @{Name="Theme";Expression={$_.Name}

},
@{Name="Type";Expression={$_.ThemeType}},
@{Name="RelativeUrl";Expression={$_.ServerRelativeUrl}},
@{Name="Description";Expression={$_.AccessibleDescription}}

else {
Write-Host "Default theme"
}
$spWeb.Dispose()
}

调用:Get-SPTheme -url http://siteurl


5. 设置站点Logo,标题和描述

$spWeb = Get-SPWeb -Identity http://siteurl

$spWeb.SiteLogoUrl = "http://siteurl/Pictures/logo.bmp"

$spWeb.SiteLogoDescription = "My Description"

$spWeb.Update()

$spWeb.Dispose()


$spWeb = Get-SPWeb -Identity http://siteurl
$spWeb.Title = "New Title"
$spWeb.Description = "New Description"
$spWeb.Update()
$spWeb.Dispose()


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值