question

sns1 avatar image
1 Vote"
sns1 asked sns1 commented

Script error when tried to get the sites list where particular feature should be activated

Script error when tried to get the sites list where particular feature should be activated
Below is the error . Also want to export results to excel. Please help
106293-scripterror.png


office-sharepoint-server-administration
scripterror.png (402.7 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

CaseyYangMSFT-4714 avatar image
0 Votes"
CaseyYangMSFT-4714 answered sns1 commented

Hi @sns1

Per my test, you could try the following PowerShell codes to check if feature is activated. Note: Please make sure the feature display name is right.

PowerShell codes:

 Add-PSSnapin "Microsoft.SharePoint.PowerShell"
    
 $web = Get-SPWebApplication -Identity "web application URL"   
 Foreach($site in $web.Sites)   
 {   
   $feature = Get-SPFeature -Site $site | Where-Object {$_.DisplayName -eq "the feature you want to check"  
 }   
   if($feature -ne $null)   
   {   
     Write-Host $site.RootWeb.Url " - Activated"   
   }   
   if($feature -eq $null)   
   {   
     Write-Host $site.RootWeb.Url " - Deavtivated"   
   } 
 }

106510-1.png


If an Answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.




1.png (19.6 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Casey Young,

Script is working.
Can you please suggest me how to get these results to export to excel?
What and where I have to add respective parameters in the script?
P

0 Votes 0 ·