andrew.beals@nintex.com

Programmatically activate sharepoint Features on all site collections, sites and sub-sites.

Blog Post created by andrew.beals@nintex.com Support on Aug 28, 2015

warning.png WARNING warning.png

Running a powershell script on everything in your farm can have a large unforeseeable performance impact.

Know that these scripts do no discriminate on what site or site collection they run on.

They will target everything in the site collection / web application scope.

The scripts below are provided as is and should be reviewed carefully before executing

 

-----------------------------------------------------------------------------------------------------

 

The following scripts can be used to activate features (Not just nintex!) on all objects in a farm. Whether the feature is scoped as a "Site" or "web" feature depends on what command you will need to use. Once again, please be aware that this can tax your farm quite a bit depending on the size of your farm and number of sites. I have added a pause to the script to reduce this impact.

 

Feel free to adjust the "Start-Sleep" command to the number of seconds you are comfortable with between iterations. I have set the sleep time to a default "5" seconds to avoid anybody executing this script without heeding its warnings.

 

Activate a site scoped feature on all site collections in a single web application:

(Potential Performance Impact: LOW )

You can use this script to activate a Site scoped feature on all site collections in a web application.

$feature = Get-SPFeature "EnterFeatureDisplayNameHere"

$siteCollections = Get-SPSite –WebApplication "EnterYourWebApplicationURL"

$siteCollections | ForEach-object {Enable-SPFeature -identity $feature -Url $_.Url; Start-Sleep -s 5}

Activate a web scoped feature on all sites on all site collections in a web application:

(Potential Performance Impact: VERY HIGH )

You can use this script to activate a web scoped feature on all sites/subsites in all site collections in a web application

$feature = Get-SPFeature "EnterFeatureDisplayNameHere"

$site = Get-SPSite –WebApplication "EnterYourWebApplicationURL"

$site | Get-SPWeb -Limit all | ForEach-Object {Enable-SPFeature -Identity $feature -Url $_.URL; Start-Sleep -s 5}

Activate a web scoped feature on all sites in a single site collection:

(Potential Performance Impact: MEDIUM )

You can use this script to activate a web scoped feature on all sites/subsites in a single site collection.

$feature = Get-SPFeature "EnterFeatureDisplayNameHere"

$site = Get-SPSite -Identity "EnterSiteCollectionURL"

$site | Get-SPWeb -Limit all | ForEach-Object {Enable-SPFeature -Identity $feature -Url $_.URL; Start-Sleep -s 5}

 

As a reference here is a list of the Nintex Features and their scopes:

 

NintexFormsFarmada0910e-a663-4db4-a19c-d8a097317b8715Farm
NintexWorkflowClaimsMigration4db97f4c-e643-4b1b-9f6a-43a9d817e6a215Farm
NintexFormsWebApplication0cdf436f-61b0-43d2-b250-4360f0353b6315WebApplication
NintexFormsListSite202afc3c-7384-4700-978d-6da3d3cce19215Site
NintexFormsLiveSite23fce797-ac15-4451-b8da-cf8ac6de691215Site
NintexFormsSitePrerequisites716f0ee9-e2b0-41f0-a73c-47ed73f135de15Site
NintexFormsWorkflowSiteac8addc7-7252-4136-8dcb-9887a277ae2c15Site
NintexWorkflow0561d315-d5db-4736-929e-26da142812c515Site
NintexWorkflowContentTypeUpgrade86c83d16-605d-41b4-bfdd-c75947899ac715Site
NintexWorkflowEnterpriseWebParts53164b55-e60f-4bed-b582-a87da32b92f115Site
NintexWorkflowInfoPath80bf3218-7353-11df-af9f-058bdfd7208515Site
NintexWorkflowLiveSite54668547-c03f-4bb5-aaab-d9568ebaf9c915Site
NintexWorkflowWebPartseb657559-be37-4b91-a369-1c201183c77915Site
NintexFormsAdminWeb70f4f7da-4fb4-4e30-ba1a-a733efb2e1ac15Web
NintexLiveAdminLinks29e9a673-31a4-46a3-b0d2-d8e1db1dbd9214Web
NintexWorkflowAdminf7937973-0cf9-4f2d-a549-be2d3c25b77215Web
NintexWorkflowEnterpriseAdminaa61ef91-ee2b-42d5-9911-7c6557ad90c215Web
NintexWorkflowEnterpriseWeb2fb9d5df-2fb5-403d-b155-535c256be1dc15Web
NintexWorkflowLiveAdminWeb485f5158-4b8a-453f-9eeb-7b33f5112adf15Web
NintexWorkflowWeb9bf7bf98-5660-498a-9399-bc656a61ed5d15Web

 

A final note: The "NintexWorkflow" site feature needs to be activated BEFORE the "NintexWorkflowWeb" web feature. Some features may have dependencies on other higher scoped features. I generally recommend you test activating a site/web feature to ensure it works before executing these scripts.

 

Alternatively you can use these commands to deactivate features if needed! Instead use the Disable-SPFeature in place of the Enable-SPFeature.

 

Please let me know if you have any questions.

 

Cheers,

Andrew Beals

Outcomes