Sunday, December 12, 2010

Install/Uninstall User Solution Application Wide

Build on this blog post on how to get sandboxed on the farm, I also need to be able to install/uninstall sandboxed solution farm wide. There for I made they have two functions to wrap the install and Uninstall-SPUserSolution SPUserSolution.

The core code is when a call (a version 2) of the Get-UserSolution filter to get the deactiveated solutions and then call the build-in cmdlet Install-SPUserSolution

  1. $gc = Start-SPAssignment
  2. Get-UserSolution -SiteCollection $SiteCollection -Filter $Filter -Verboses:$Verboses | `
  3. Where-Object -FilterScript { $_.Status -eq "Deactivated" } | `
  4. Install-SPUserSolution -Site $SiteCollection -AssignmentCollection $gc
  5. Stop-SPAssignment $gc

The code:

No comments:

Post a Comment