Thursday 8 August 2013

Powershell Commands for Installing Solutions and Features in SharePoint.

Earlier i discussed about how to add the solution (WSP) to the SharePoint. In the continuation now i am going to explain how to install (Deploy) the solution to the concern web application.

After that how to enable or disable the feature through powershell.

To know about adding solution in SharePoint Click Here.

Installing the Solution

After adding a solution definetly we need to deploy the solution to web application. To do that we have command called Install-SPSolution. Syntax and Example are provided below for your understanding.

SYNTAX
    Install-SPSolution [-Identity] <SPSolutionPipeBind> [-AllWebApplications <S
    witchParameter>] [-AssignmentCollection <SPAssignmentCollection>] [-CASPoli
    cies <SwitchParameter>] [-Confirm [<SwitchParameter>]] [-Force <SwitchParam
    eter>] [-GACDeployment <SwitchParameter>] [-Language <UInt32>] [-Local <Swi
    tchParameter>] [-Time <String>] [-WebApplication <SPWebApplicationPipeBind>
    ] [-WhatIf [<SwitchParameter>]] [<CommonParameters>]

    Install-SPSolution [[-Identity] <SPSolutionPipeBind>] -Synchronize <SwitchP
    arameter> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<Swit
    chParameter>]] [-Language <UInt32>] [-WhatIf [<SwitchParameter>]] [<CommonP
    arameters>]

Example:

Install-SPSolution –Identity recruitment.wsp –WebApplication http://myrecruitmentsite -GACDeployment

Note: You can also use the following parameters
                     –CASPolicies: If you are not deploying to the GAC
                     –AllWebApplications: if you want to deploy the solution to all web applications
                     –Force: to force the deployment of the solution
                     -GACDeployment: It will place the DLL files to the Assembly folder in Windows directory.

Updating the Solution in SharePoint
Without redeploying the solution you need to overwrite the solution with some changes in the code level means, we can use Update-SPSolution. The example are provided below.


Update-SPSolution –Identity recruitment.wsp –LiteralPath E:\solutions\recruitment.wsp –GACDeployment

Uninstalling the Solution from SharePoint

This command will just retract your solution from the specified web application. After executing the below command the mentioned web application can't use the feature which are bind with the solution.

Uninstall-SPSolution –Identity recruitment.wsp –WebApplication http://myrecruitmentsite

Removing the Solution from SharePoint

This command will completely remove your solution from the SharePoint server. Before executing this command the solution should be retracted from all the web application where it deployed.

Remove-SPSolution –Identity recruitment.wsp


Enable or Disable the Feature in SharePoint

The below command will help you to enable or disable the feature to the site level.

Enable-SPFeature –Identity RefertheBuddy –url http://myrecruitmentsite

Disable-SPFeature –Identity RefertheBuddy –url http://myrecruitmentsite

Thanks Guys for Watching this Blog. :-)

No comments:

Post a Comment

Rescan Disk Option Greyed Out | New Disks Not visible on Disk management | Update-HostStorageCache

  Recently I have added several LUN from NetApp Storage to Hyper-V servers. But in the disk management I couldn't see those new LUN. Exi...