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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.