Wednesday, May 29, 2013

Powershell

http://go.microsoft.com/fwlink/?LinkId=190342

http://blksthl.files.wordpress.com/2012/06/sharepoint-2010-site-settings-explained.pdf

http://technet.microsoft.com/en-us/library/ff607950.aspx

Installing and Deploying a Solution Package
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction "SilentlyContinue"
Add-SPSolution -LiteralPath "C:\Solutions\WingtipDevProject1.wsp"
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction "SilentlyContinue"
Add-SPSolution -LiteralPath "C:\Solutions\WingtipDevProject1.wsp"
Install-SPSolution -Identity "WingtipDevProject1.wsp" -Local -GACDeployment
Retracting and Removing a Solution
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction "SilentlyContinue"
$SolutionPackageName = "WingtipDevProject1.wsp"
Uninstall-SPSolution -Identity $SolutionPackageName -Local -Confirm:$false
Once you’ve retracted the solution using the Uninstall-SPSolution cmdlet, you can then remove
it by calling Remove-SPSolution, which instructs SharePoint Foundation to delete the solution
package file from the configuration database.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction "SilentlyContinue"
$SolutionPackageName = "WingtipDevProject1.wsp"
Uninstall-SPSolution -Identity $SolutionPackageName -Local -Confirm:$false
Remove-SPSolution -Identity $SolutionPackageName -Confirm:$false

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction "SilentlyContinue"
$SolutionPackageName = "WingtipDevProject1.wsp"
$solution = Get-SPSolution | where-object {$_.Name -eq $SolutionPackageName}
# check to see if solution package has been installed
if ($solution -ne $null) {
# check to see if solution package is currently deployed
if($solution.Deployed -eq $true){
Uninstall-SPSolution -Identity $SolutionPackageName -Local -Confirm:$false

DeploySolution.ps1
$SolutionPackageName = $args[0]
$SolutionPackagePath = $args[1]
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction "SilentlyContinue"
$solution = Get-SPSolution | where-object {$_.Name -eq $SolutionPackageName}
if ($solution -ne $null) {
if($solution.Deployed -eq $true){
Uninstall-SPSolution -Identity $SolutionPackageName -Local -Confirm:$false
}
Remove-SPSolution -Identity $SolutionPackageName -Confirm:$false
}

Updating a solution
$SolutionPackageName = $args[0]
$SolutionPackagePath = $args[1]
Add-PSSnapin Microsoft.SharePoint.Powershell
# ensure previous version of solution package is already deployed
$solution = Get-SPSolution | where-object {$_.Name -eq $SolutionPackageName}
if ($solution -ne $null) {
if($solution.Deployed -eq $true){
Update-SPSolution -Identity $SolutionPackageName
-LiteralPath $SolutionPackagePath
-Local -GACDeployment
}
else {
Write-Host "Solution package cannot be updated because it is not deployed"
}
Add-SPSolution -LiteralPath $SolutionPackagePath
Install-SPSolution -Identity $SolutionPackageName -Local -GACDeployment

No comments:

Post a Comment