Activate publishing feature in SharePoint 2013/2016 using PowerShell

In this SharePoint 2013 tutorial, we will discuss how to enable or disable SharePoint 2013 publishing feature using PowerShell in SharePoint 2013/2016. Learn how to activate publishing feature SharePoint 2013/2016 using PowerShell. We will also see how to enable the publishing feature in SharePoint 2010.

Here we will first disable the publishing feature and then we will enable the publishing feature in SharePoint.

If you are new to PowerShell SharePoint, read an article on Working with PowerShell in SharePoint Online/2016/2013.

Enable or Disable publishing features SharePoint 2013 PowerShell

Now, we will discuss how to enable or disable publishing features in SharePoint 2013/2016 using PowerShell.

Add-PSSnapin “Microsoft.SharePoint.PowerShell”

Get-SPWeb -site http://SiteCollectionURL -limit ALL | ForEach-Object {Disable-SPFeature Publishing -Url $_.Url -confirm:$false}

Get-SPWeb -site http://SiteCollectionURL -limit ALL | ForEach-Object {Disable-SPFeature PublishingWeb -Url $_.Url -confirm: $false}

Get-SPWeb -site http://SiteCollectionURL -limit ALL | ForEach-Object {Enable-SPFeature Publishing -Url $_.Url -confirm:$false}

Get-SPWeb -site http://SiteCollectionURL -limit ALL | ForEach-Object {Enable-SPFeature PublishingWeb -Url $_.Url -confirm: $false}

Activate SharePoint 2013 Server Publishing Feature using PowerShell

This section we will discuss, how we can enable the SharePoint 2013 server publishing feature using PowerShell. If within a Site collection if you have multiple subsites, then PowerShell will be very much helpful in activating the Publishing feature in all subsites, we do not need to go to each site and activate from the browser.

Enable Publishing feature in SharePoint using PowerShell (Site Collection Level)

Below is the PowerShell command to activate publishing feature in all sites and subsites within a site collection.

$site = Get-SPSite https://SiteCollection URL/
$site | Get-SPWeb -limit all | ForEach-Object {Enable-SPFeature -Identity “PublishingWeb” -Url $_.Url}
$site.Dispose()

Enable Publishing feature in SharePoint using PowerShell (Individual Site Level)

Below is the PowerShell command if you want to activate the publishing feature for a particular site.
Individual Site:

Enable-SPFeature -Identity PublishingWeb -URL https://SiteURL/ -Force

Error while activating SharePoint Server Publishing Feature in SharePoint 2013/2016

Now we will discuss, how to resolve the access denied issue when the user tried to activate or deactivate the SharePoint server publishing feature. The user who was trying to activate was having full control permission is site collection as well as a subsite.

The user was having full control in the subsite as well as in the site collection, but still when the user was trying she was getting access denied.

The user should be a site collection administrator to activate or deactivate the feature on the subsite. Or the user should be a part of “Hierarchy Managers” group for the site collection that contains the subsite.

Then only the user will be activated or deactivate the feature in SharePoint 2013/2016.

The feature failed to activate because a list at PublishingImages already exists in this site

Recently in a migration project, we faced one issue while trying to activate SharePoint 2013 publishing feature in a subsite. The error comes as:

Sorry, something went wrong
The feature failed to activate because a list at ‘PublishingImages’ already exists in this site. Delete or rename the list and try activating the feature again.
TECHNICAL DETAILS

Troubleshoot issues with Microsoft SharePoint Foundation.
Correlation ID: dd9a469d-9e16-a03f-d3a2-794a2716f9d9

The issue basically comes for us in MOSS 2007 to SharePoint 2013 migrated sites. I got two approaches to solve the issue.

First Approach:
We need to go to the PublishingImages library and rename the document library name to some other from the library settings page.

Then try to activate the publishing feature.

Second Approach:
For few subsites the other approach I have tried is I have activated the Publishing feature by using PowerShell command by using the -Force parameter.

The PowerShell command is like below:

Enable-SPFeature -Identity PublishingWeb -URL https://SiteURL/ -Force

Enable publishing features in SharePoint 2010

We will also see now, how to enable publishing features in SharePoint 2010 sites also,

Before creating any publishing site in your site collection you need to enable publishing feature. If you will not enable then you will get the below error: The Office SharePoint Server Publishing Infrastructure feature must be activated at the site collection level before the Publishing feature can be activated.

So to enable publishing feature to follow below step:

Go to Site Actions -> Site Settings as shown in the figure below:

Enable publishing features in SharePoint 2010

This will open the Site Settings page. From the Site Settings page go to the Site Actions section and click on Manage Site Features as shown in the figure below.

Enable publishing features in SharePoint 2010

This will open the list of features and select SharePoint Server Publishing and click on Activate as shown in the figure below.

Steps to Enable publishing features in SharePoint 2010

You may like following SharePoint PowerShell tutorials:

Hope this SharePoint 2013 tutorial explains how to activate publishing feature in SharePoint 2013/2016 using PowerShell. We also learn how to solve The feature failed to activate because a list at ‘PublishingImages’ already exists in this site.

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)

envelope
envelope

Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

>