Skip to content

Commit 7093575

Browse files
authored
Update enablefeature.ps1
1 parent 3633ea2 commit 7093575

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

Site Management/Features/Enable feature/enablefeature.ps1

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,25 @@ $featureguid=new-object System.Guid $feature
2424
$RemoveorAdd= Read-Host "Do you want to activate the feature to the sites (a) or deactivate it (d)? Press a or d."
2525
$RemoveorAdd=$RemoveorAdd.Trim()
2626

27-
if($RemoveorAdd -like "a")
28-
{
29-
30-
foreach($site in $sites)
31-
{
27+
if($RemoveorAdd -like "a"){
28+
foreach($site in $sites){
3229
$site.Features.Add($featureguid, $true, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None)
3330
#$site.Features.Remove($featureguid, $true);
3431
$ctx.ExecuteQuery()
3532
Write-Host "Feature enabled for" $site.Url
36-
}
37-
Write-Host "Done."
33+
}
34+
Write-Host "Done."
3835
}
39-
elseif($RemoveorAdd -like "d")
40-
{
41-
42-
foreach($site in $sites)
43-
{
36+
elseif($RemoveorAdd -like "d"){
37+
foreach($site in $sites){
4438
$site.Features.Remove($featureguid, $true);
4539
$ctx.ExecuteQuery()
4640
Write-Host "Feature removed for" $site.Url
47-
}
41+
}
4842
Write-Host "Done."
4943
}
50-
else
51-
{
52-
Write-Host "Didn't recognize the command"
44+
else{
45+
Write-Host "Didn't recognize the command"
5346
}
5447

5548

0 commit comments

Comments
 (0)