PowerShell Screept For Enable Nintex Workflow Feature on all Site Collections and it’s all Sub sites
Add-PsSnapin Microsoft.SharePoint.PowerShell
## SharePoint DLL
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$webApplicationURL = "http://WebApplicationURL"
$featureFolderName = "NintexWorkflowWeb"
$webApp = Get-SPWebApplication $webApplicationURL
if($webApp -ne $null)
{
foreach($siteColl in $webApp.Sites)
{
foreach($subWeb in $siteColl.AllWebs)
{
$FeatureID = Get-SPFeature -Web $subWeb.Url |
Where {$_.DisplayName -eq $featureFolderName}
if (Get-SPFeature -Web $subWeb.Url | Where {$_.ID -eq
$FeatureID.Id})
{
Write-Host
$featureFolderName "is already activated at :" $subWeb.Url
#$subWeb.url | Out-File -FilePath
F:\AlreadyActivatedSites.txt -Append
}
else
{
Enable-SPFeature
-Identity $featureFolderName -Confirm:$false -Url $subWeb.url
Write-Host
$featureFolderName "has been activated at :" $subWeb.url
#$subWeb.url | Out-File -FilePath
F:\ActivatedSites.txt -Append
}
$subWeb.Dispose()
}
}
$siteColl.Dispose()
}
else
{
Echo $webApplicationURL "does not exist, check the
WebApplication name"
}
Remove-PsSnapin Microsoft.SharePoint.PowerShell
Echo Finish
Option Second:
Enable the Nintex Workflow Feature on all Sub sites
$web = get-spweb http://WebApplicationURL
function EnableNintexWorkflowSiteFeature( $w )
{
$ws = $w.Webs;
foreach( $subweb in $ws)
{
EnableNintexWorkflowSiteFeature($subweb)
}
echo 'Enabling Nintex Workflow on site : ' $w.Url
Enable-SPFeature NintexWorkflowWeb -url $w.Url
}
echo 'Enabling Nintex Workflow on site : ' + $web.Url
EnableNintexWorkflowSiteFeature $web
Enable the Nintex Workflow Feature on all Sub sites
$web = get-spweb http://WebApplicationURL
function EnableNintexWorkflowSiteFeature( $w )
{
$ws = $w.Webs;
foreach( $subweb in $ws)
{
EnableNintexWorkflowSiteFeature($subweb)
}
echo 'Enabling Nintex Workflow on site : ' $w.Url
Enable-SPFeature NintexWorkflowWeb -url $w.Url
}
echo 'Enabling Nintex Workflow on site : ' + $web.Url
EnableNintexWorkflowSiteFeature $web
Comments
Post a Comment