What would be the supported way for hiding Nintex Workflow 2013 and Forms 2013 Features from the site and web features from the user interface?
The reason is we would like to offer Nintex only for a couple of sites in the web application and the activation should be done manually via Powershell based on request.
One option came to my mind is editing feature XMLs to hide the features, but in which feature folders exactly and what is the activation process with powershell, Which features in which order?
Does anybody have a script already written? I'm not interested in the activation with stsadm and the articles written for Nintex 2007 and Nintex 2010 as there are old outdated. We use Nintex 2013 and there might be new features or different ones and the activation order would be also important.
Thanks
You can do this by updating the hidden property in the feature.xml, but I recommend against changing any of these files in the layouts/features. You could also do this using PowerShell and update the feature through the object model.
But there is one big issue to setting the features to hidden. Some of them have dependencies on others. SharePoint does not allow hidden features to have dependencies. Actually, you can set a feature to hidden that has dependencies, but SharePoint will never allow you to activate it and will throw an error.
So it will be tough to hide the features from site collection admins. But you might be able to hide permission for site owners (non collection admins) by giving them a custom permission level below full control. I think the one to remove is Manage Web Site. Or you could remove other levels as well to restrict an owner.
Also note, if you change the feature.xml and then update Nintex with a new build, your changes will be lost most likely.
Hello,
Finally I decided to write my own solution which can be manually started after each Nintex update or scheduled via windows task scheduler:
Nintex feature hide script:
#***********************************************************************************************************
# Hide Nintex features from the UI - Csaba Sztancsik (2015)
#***********************************************************************************************************
$FeaturesDefinition = "E:\Scripts\Nintex Features.csv"
$LiveMode = "Yes" #Yes to make changes or No for simulation and log creation only
#***********************************************************************************************************
# You do not need to modify anything below this line
#***********************************************************************************************************
asnp *sharepoint* -ea 0
$NintexFeatures = Import-Csv $FeaturesDefinition -Delimiter ";"
$SPServers = (Get-SPFarm).Servers | ?{$_.Role -match "Application"} | %{$_.Address}
$ModifiedFeatures = @()
clear
Write-Host "Searching for visible Nintex features..."
Write-Host ""
Foreach ($Nintexfeature in $NintexFeatures)
{
Try
{
foreach ($SPServer in $SPServers)
{
$FeatureXMLFullPath = "\\" + $SPServer + "\" + $Nintexfeature.'Feature Folder'.Replace("C:","C$") + "\feature.xml"
$FeatureXMLContent = [xml] (Get-Content $FeatureXMLFullPath)
if ($FeatureXMLContent.Feature.GetAttribute("Hidden") -ne "TRUE")
{
Write-Host $Nintexfeature.'Feature Name' -Foregroundcolor yellow -NoNewLine
Write-Host " is not hidden on server " -NoNewLine
Write-Host $SPServer -ForegroundColor Yellow -NoNewLine
Write-Host " Hiding feature... " -NoNewLine
$FeatureState = $FeatureXMLContent.Feature.GetAttribute("Hidden")
if (!$FeatureState) {$FeatureState = "Hidden Attribute was not exist"}
$FeatureXMLContent.Feature.SetAttribute("Hidden", "TRUE")
if ($LiveMode -eq "Yes") {$FeatureXMLContent.Save($FeatureXMLFullPath)}
$FeatureXMLContent = [xml] (Get-Content $FeatureXMLFullPath)
#Removing Activation Dependencies
$FeatureXMLContent.Feature.ActivationDependencies.RemoveAll()
if ($LiveMode -eq "Yes") {$FeatureXMLContent.Save($FeatureXMLFullPath)}
$Properties = @{
'Server Name' = $SPServer
'Feature Name' = $Nintexfeature.'Feature Name';
'Feature Old State' = $FeatureState;
'Feature New State' = $FeatureXMLContent.Feature.GetAttribute("Hidden");
'Activation Dependencies Removed' = "";
'Modified at' = Get-Date -format "yyyy.mm.dd HH:mm:ss"
}
$FeatureObject = New-Object -TypeName psobject -Property $Properties
$ModifiedFeatures += $FeatureObject
if ($FeatureXMLContent.Feature.GetAttribute("Hidden") -eq "TRUE") {Write-Host "OK" -ForeGroundColor Green} else {Write-Host "Error" -ForeGroundColor Red}
$FeatureState = $null; $FeatureXMLContent = $null
}
}
}
Catch
{
Write-Host $_.Exception.Message -foregroundcolor cyan
}
}
if ($ModifiedFeatures)
{
$ResultsFullPath = (Split-Path $script:MyInvocation.MyCommand.Path -Parent) + "\Log_NintexFeatureModification_" + (Get-Date -format "yyyy-mm-dd_HH_mm_ss") + ".csv"
$ModifiedFeatures | Select 'Server Name','Feature Name','Feature Old State','Feature New State','Modified at' | Export-Csv $ResultsFullPath -Delimiter ";" -NoTypeInformation
$ModifiedFeatures
}
Write-Host ""
Write-Host "Script finished."
Nintex Feature definition csv:
UI Name;Feature Name;Feature Folder;Feature ID;Activate;Activation Order
Nintex Workflow 2013;NintexWorkflowContentTypeUpgrade;C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\FEATURES\NintexWorkflowContentTypeUpgrade;86c83d16-605d-41b4-bfdd-c75947899ac7;True;01
Nintex Workflow 2013;NintexWorkflow;C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\FEATURES\NintexWorkflow;0561d315-d5db-4736-929e-26da142812c5;True;02
Nintex Workflow 2013 InfoPath Forms;NintexWorkflowInfoPath;C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\FEATURES\NintexWorkflowInfoPath;80bf3218-7353-11df-af9f-058bdfd72085;True;03
Nintex Workflow 2013 Web Parts;NintexWorkflowWebParts;C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\FEATURES\NintexWorkflowWebParts;eb657559-be37-4b91-a369-1c201183c779;True;04
Nintex Workflow 2013 Reporting Web Parts;NintexWorkflowEnterpriseWebParts;C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\FEATURES\NintexWorkflowEnterpriseWebParts;53164b55-e60f-4bed-b582-a87da32b92f1;False;05
Nintex Forms Prerequisites Feature;NintexFormsSitePrerequisites;C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\FEATURES\NintexFormsSitePrerequisites;716f0ee9-e2b0-41f0-a73c-47ed73f135de;True;06
Nintex Forms for SharePoint List Forms;NintexFormsListSite;C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\FEATURES\NintexFormsListSite;202afc3c-7384-4700-978d-6da3d3cce192;True;07
Nintex Forms for Nintex Workflow;NintexFormsWorkflowSite;C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\FEATURES\NintexFormsWorkflowSite;ac8addc7-7252-4136-8dcb-9887a277ae2c;True;08
Nintex Workflow 2013;NintexWorkflowWeb;C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\FEATURES\NintexWorkflowWeb;9bf7bf98-5660-498a-9399-bc656a61ed5d;True;09
Nintex Workflow 2013 Enterprise Reporting;NintexWorkflowEnterpriseWeb;C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\FEATURES\NintexWorkflowEnterpriseWeb;2fb9d5df-2fb5-403d-b155-535c256be1dc;False;10
Nintex Workflow - Nintex Live Catalog;NintexWorkflowLiveSite;C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\FEATURES\NintexWorkflowLiveSite;54668547-c03f-4bb5-aaab-d9568ebaf9c9;False;11
Nintex Live Forms;NintexFormsLiveSite;C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\FEATURES\NintexFormsLiveSite;23fce797-ac15-4451-b8da-cf8ac6de6912;False;12
Nintex Activation script:
param
(
# Absolute URL of the site
[parameter(Mandatory=$true, ValueFromPipeline=$false)]
[string]$SiteUrl
)
#*********************************************************************************
$FeaturesDefinition = "E:\Scripts\Nintex Features.csv"
$LiveMode = "Yes" #Yes to make changes or No for simulation and log creation only
#*********************************************************************************
Write-Host ""
Write-Host "Checking prerequisites..."
asnp *sharepoint* -ea SilentlyContinue
# Content database validation - Skip this part if you don't want to dedicate a content DB to this Nintex site
$DB = (Get-SPSite $SiteUrl).ContentDatabase
if ($DB.SiteCount -gt 1)
{
Write-Host ""
Write-Host "WARNING: " -ForegroundColor Red -NoNewline
Write-Host "The site must be moved with Move-SPSite command to dedicated content database prior Nintex activation." -ForegroundColor White
Write-Host ""
Write-Host "! Moving the site will cause impairment for the site object and requires IIS Reset, this must be communicated to site owners" -ForegroundColor Yellow
Write-Host "! You must create a Nintex Workflow database prior Nintex activation and the Workflow database must be connected to the SharePoint Content database where the site moved." -ForegroundColor Yellow
Write-Host ""
Write-Host "Please handle these steps manually, then activate Nintex with the " -ForeGroundColor White -NoNewline
Write-Host " Activate-Nintex.ps1" -ForegroundColor Yellow
Write-Host ""
Write-Host ""
Exit
}
# End of content database validation
$NintexFeatures = Import-Csv $FeaturesDefinition -Delimiter ";" | ?{$_.Activate -eq "True"}
Write-Host "Activating Nintex features on site " -NoNewLine
Write-Host $SiteURL -foregroundcolor cyan
Write-Host ""
Foreach ($Nintexfeature in $NintexFeatures)
{
Write-Host "Activating " -NoNewLine
Write-Host $Nintexfeature.'Feature Name' -ForeGroundColor Yellow
Enable-SPFeature -Identity $Nintexfeature.'Feature ID' -URL $SiteURL
}
Write-Host ""
Write-Host $SiteURL -NoNewLine -Foregroundcolor White
Write-Host " completed." -foregroundcolor green
Write-Host ""
This is great information to share and useful to the community! I just want to note that for those that want this ability to hide the features there are a few things to note. You will not copy and paste this PowerShell into an editor and just run it. He created two pieces, one to remove the dependencies of the features and hide the feature, the second to activate the features on a site (because now they are hidden). You will not run the hide script more than once, like once per site.
Any updates to Nintex that are installed may overwrite the feature xml files that this script is changing and thus make the features visible again.
Make sure your path to your 15 hive is the same as provided.
And Csaba Sztancsik, I want to thank you for this, and it is very useful, but it would only be fair to mention to those that want to use it that changing the Feature XML file of a feature isn't the best of practices and could affect your farm. Test it out before you use it in production. But if you have to hide the features from your site admins and you cannot simply change their permissions, this is really the only way to do it.
We are facing the same error in SharePoint 2016 while saving site as a template.
I can see in the logs that a feature.xml has been changed and SharePoint is not able to detect this as a result of which it says feature with dependency not found.
I can see the PowerShell above to show changed features.But the csv has listed the Nintex 2013 features in it.
Can you please provice me a list of Nintex 2016 features so that i can run the PowerShell and detect which features have been changed/effected .
Any help will be really appreciated.