Hey, I try to activate a branding feature at site collection level with power shell. $SPsite = Get-SPSite “Url” $Feature = Get-SPFeature “my Feature” Enable-SPFeature -Identity $Feature -Url $SPsite.Url $SPsite.Dispose() There comes an error: Enable-SPFeature: Unable to cast object of type 'Microsoft.SharePoint.SPSite' to type 'Microsoft.SharePoint.SPWeb'. When I do it over the GUI -> Site Settings -> Site Collection Features -> activate.
It works perfekt. What can I do to bring the powershell script to run? Greetings Stefan. Hi Stefan, Please deactivate a default site collection feature in SharePoint UI, then try to activate using PowerShell, check whether it could work well. If only your branding feature could not be activated by PowerShell, this issue should be about your branding feature, please debug it. In addition, please check if the link is useful for you: Best Regards, Wendy TechNet Community Support Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help.
If you have feedback for TechNet Support, contact. Hey, I try to activate a branding feature at site collection level with power shell. $SPsite = Get-SPSite “Url” $Feature = Get-SPFeature “my Feature” Enable-SPFeature -Identity $Feature -Url $SPsite.Url $SPsite.Dispose() There comes an error: Enable-SPFeature: Unable to cast object of type 'Microsoft.SharePoint.SPSite' to type 'Microsoft.SharePoint.SPWeb'. When I do it over the GUI -> Site Settings -> Site Collection Features -> activate. It works perfekt.
What can I do to bring the powershell script to run? Greetings Stefan. Hi Stefan, Please deactivate a default site collection feature in SharePoint UI, then try to activate using PowerShell, check whether it could work well. If only your branding feature could not be activated by PowerShell, this issue should be about your branding feature, please debug it. In addition, please check if the link is useful for you: Best Regards, Wendy TechNet Community Support Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact.
Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.
When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur. Type: SPAssignmentCollection Position: Named Default value: None Accept pipeline input: True (ByValue) Accept wildcard characters: False Applies to: SharePoint Server 2010, SharePoint Server 2013, SharePoint Server 2016.
In this blog we will see about how to activate specific feature to all site collection which is inside the particular web application using powershell script. PnP-PowerShell - SharePoint. Enable-SPOFeature / Disable-SPOFeature not working as documented. If you want to activate a feature that you deployed yourself. Dec 15, 2016. Scenario Activating SharePoint's Publishing features can easily be done on a single site collection or site. But what if you need to activate Publishing on a hierarchy of subsites, or across multiple site collections? Code Once again, we're using the PnP PowerShell cmdlets. First some basics. Discovering, Activating, and Deactivating Features In A SharePoint Site Collection Using PowerShell. List of ALL features that are active in the Site. Find out how you can save time by using Sharegate when activating SharePoint features. Activate features with a PowerShell. Activate 8 features at the site.