首页 > 其他专区 > SharePoint >

如何利用命令行管理SharePoint Feature?

SharePoint 2023-01-12

一般情况下对IT管理者来说,在SharePoint Farm中维护Feature,更喜欢使用命令行实现,这样可以省去登录到具体站点的操作。比如IT接到end user的一个需求,要开启Site Collection Feature,如果直接操作就要登录site collection-> Site Setting找到Feature点击执行enabledisable,要是使用命令行直接输入命令和网站会更快捷。

下面我们就以SharePoint 2013为例,看下对于Feature的enable、disable、get、install、uninstall的命令都要怎么执行:

  • Install Feature
  1. 登录SharePoint Server,将build好的Feature先copy到SharePoint安装目录"…Program FilesCommon Filesmicrosoft sharedWeb Server Extensions15TEMPLATEFEATURES";

如何利用命令行管理SharePoint Feature?

  1. Administrator方式打开SharePoint 2013 Management Shell,输入命令并执行;

Install-SPFeature-path "Feature Folder Name"

如何利用命令行管理SharePoint Feature?

  1. 此时登录一个site collection,Site Settings-> Site Features,可以看到install的Feature,默认是disable状态。

如何利用命令行管理SharePoint Feature?

  • Enable Feature
  1. 仍然是Administrator方式打开SharePoint2013 Management Shell,输入命令并执行;

Enable-SPFeature-identity "Feature Name" - URL"Site Collection URL"

如何利用命令行管理SharePoint Feature?

  1. 登录到Site Collection,Site Settings中查看Feature情况,成功被启用。

如何利用命令行管理SharePoint Feature?

  • Disable Feature
  1. Administrator方式打开SharePoint2013 Management Shell,输入命令并执行,在弹出的确认执行对话中输入"Y"执行;

Disable-SPFeature -identity"FeatureName" - URL "Site CollectionURL"

如何利用命令行管理SharePoint Feature?

  1. 登录到Site Collection,Site Settings中查看Feature情况,成功被禁用。

如何利用命令行管理SharePoint Feature?

  • Get Feature
  1. Administrator方式打开SharePoint2013 Management Shell,输入命令并执行,可以查询到当前site下所有的Feature。

Get-SPSite "SiteCollection URL" | Get-SPWeb -Limit ALL |%{Get-SPFeature -Web $_ } | Select DisplayName,ID -Unique

如何利用命令行管理SharePoint Feature?

  1. 在SharePoint2013 Management Shell中输入下面命令可以知道部署到Site中的Feature都有哪些。

Get-SPFeature -Limit ALL | Where-Object {$_.Scope -eq"SITE"}

如何利用命令行管理SharePoint Feature?

  • Uninstall Feature
  1. Administrator方式打开SharePoint2013 Management Shell输入命令行,在弹出确认提示中输入"Y",并执行;

Uninstall-SPFeature-identity "Feature Folder Name"-force

如何利用命令行管理SharePoint Feature?

  1. 登录SharePoint网站,查看Feature情况,已经被成功卸载。

如何利用命令行管理SharePoint Feature?

 

以上就是关于在SharePoint中对Feature执行Install、Uninstall、Enable、Disable和Get的命令,感谢阅读!


Copyright © 2016-2023 office学习教程网 office.tqzw.net.cn. All Rights Reserved.