Deploying Multiple WSP Files Using Powershell

I was playing around with some scripts today while I was working on an upgrade.  I didn’t want to individually write out the names of files in a batch file and I wanted to create a quick Powershell Script.  If you are using SharePoint 2010 you can use these lines of code in the Powershell Manager to deploy only .wsp files to your SharePoint 2010 Web Applications:

$dir = [directory]

$list = Get-ChildItem $dir | where {$_.extension -eq ".wsp"}

foreach($my_file in Get-ChildItem $list){Add-SPSolution -LiteralPath $my_file.FullName}

foreach($my_file in Get-ChildItem $list){Install-SPSolution -Identity $my_file.Name -AllWebApplications -GACDeployment}


Basically, you throw in the directory into a variable, then you throw the files into a variable in Powershell filtered by .wsp.  Then you loop through the files and add the solutions to the store, then loop through the files and deploy them to the web applications.  You can change the scripts accordingly.  I figured this would be something you all could use so enjoy!

Print | posted on Wednesday, August 18, 2010 1:31 PM


# re: Deploying Multiple WSP Files Using Powershell

Left by Dilip Nikam at 11/2/2010 10:56 AM
Gravatar I want to deploy one wsp to multiple web application one bye one. Is this possiable by PowerShell?

Your comment:


Copyright © MOSSLover

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski