Showing posts with label update. Show all posts
Showing posts with label update. Show all posts

November 09, 2014

SharePoint Uninstall, Remove, Add, Install SPSolution .wsp using PowerShell or STSADM

This is gonna very often command that you will keep using to Add and Activate solution in SharePoint Environment so you can bookmark it or follow the blog.

Well the deployment process includes below set of steps to Remove and Add Solutions in SharePoint.
1.      Retract
2.      Remove
3.      Add
4.      Deploy

First Deactivate Solution then Remove Solution, then Add Solution from local drive and Activate to desired scope.

There are 3 simple ways to do so.
·        From SharePoint site, go deactivate then from CA retract and remove solution.
·        Second way is STSADM.exe
·        Third and most preferred way is PowerShell.

Uninstalling SharePoint wsp package using PowerShell command

Uninstall-SPSolution –Identity “MySolution.wsp” –WebApplication “WebApp Url”

Remove SharePoint wsp package using PowerShell command

Remove-SPSolution–Identity "MySolution.wsp"

Add SharePoint wsp package using PowerShell command

Add -SPSolution "C:\Praveen\MySolution.wsp"

Installing SharePoint wsp package using PowerShell command

Install-SPSolution –Identity "MySolution.wsp" –WebApplication "url" –GACDeployment

Using STSADM command

open command prompt and Go to path,
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\BIN
 
Add Solution
stsadm.exe -o addsolution -filename "c:\Praveen\MySolution.wsp"
 
Deploy Solution
stsadm.exe -o deploysolution -name "MySolution.wsp" -url "http://server/" -allowgacdeployment -immediate

Activate feature
stsadm.exe -o activatefeature -name "MySolution.wsp" -url "http://server/"




--
Regards,
Praveen Pandit



September 21, 2013

Update Modified by and Created by in SharePoint using Powershell


Many times you have to update list with large number of items or some time we have to change Modified or created by names of all items, yeah we are aware about System.Update() method but if data has populated and no code action will take place and requirement says to update because we don't wants to confuse client and his customers so in very rare and after approval we execute it to update modified and created by names.

We can use below script to update thousands of list items in single shot. but take care once changes are done by PowerShell can not be roll back.

so to update sharepoint list items simply can save below Powershell script in a .PS1 file and run it with Elevated privileges in SharePoint server where you has permission to modify items.

PowerShell Code:
<# Created by : Praveen Pandit
   Purpose  : To update Modified and created by Names.
   Created Date : June, 2011
#>
     $targetUser=$oWeb.EnsureUser("domain\userid");  
     # in List Created by -Author and Modifed by -Editor
     $oItem["Author"] = $targetUser            
     $oItem["Editor"] = $targetUser  
     # You can add other fields here any field value data time etc....
     $oItem.Update()  
 



Please share any issue or findings on this.


--
Regards,
Praveen Pandit