1

Hello I would like to run a script to enable a site collection feature on all sites within a web application. Here is my script:

Add-PSSnapin -name "Microsoft.SharePoint.PowerShell"

$SPWebApp = Get-SPWebApplication http://sharepointtest/

foreach ($SPSite in $SPWebApp.Sites)
{

Enable-SPFeature -Identity Reporting -url $SPSite
}

I think I am not passing the url correctly as it gives this error:

enter image description here

Anyone know what I am doing wrong! Not the best with powershell by all means!

1 Answer 1

3

You are passing a SPSite object and the Enable-SPFeature just needs the URL. Just use the "URL" property of the SPSite object - $SPSite.url

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.