SharePoint 2013 Developer Tricks to use Powershell Command

* Following command is use to deploy DLL into GAC:
FOR %1 IN (*) DO Gacutil /i %1
Gacutil /i Telerik.Web.UI.dll

* Dll location
C:\Windows\Microsoft.NET\assembly\GAC_MSIL

Install Feature - Installs a SharePoint Feature by using the Feature.xml file.

stsadm -o installfeature -name "featureName1"

* Add Wsp - Uploads a SharePoint solution package to the farm/store.
stsadm -o addsolution -filename "C:\Responsive.wsp"

Add-SPSolution "C:\Responsive.wsp"

* Wsp Deployment command - Deploys an installed SharePoint solution in the farm/store.
stsadm -o deploysolution -name "Responsive.wsp" -url http://192.168.100.100:8181 -allowgacdeployment -immediate –force

Install-SPSolution –Identity "Responsive.wsp" –WebApplication http://192.168.193.100:8181 -GACDeployment -Force

* Upgrade Solution - Upgrades a deployed SharePoint solution.
stsadm –o upgradesolution –name "Responsive.wsp" –filename "C:\Responsive.wsp" –immediate –Force

Update-SPSolution –Identity "Responsive.wsp" –LiteralPath "C:\Responsive.wsp" –GACDeployment

* Solution Retract & Remove - Removes a SharePoint solution from a farm.

stsadm -o deletesolution -name "Responsive.wsp" -override

Uninstall-SPSolution -Identity "Responsive.wsp" [ –WebApplication http://192.168.100.100:8181 ] optional if not deployed globally.

Remove-SPSolution -Identity "Responsive.wsp"

* TimerJob wsp Deployment command - TimerJob work at global level in farm

stsadm -o deploysolution -name "timerjobssolution.wsp" -allowgacdeployment -immediate -force ( URL not needed as timer is global )

* Export Web Application

stsadm -o export -url http://192.168.100.146:8181 -filename "C:\Packages\NewTest.cmp" –nofilecompression

Export-SPWeb http://192.168.100.146:8181 –Path "C:\Packages\ NewTest.cmp" -nofilecompression

* Import Web application ( if web application already exist drop site collection)

stsadm -o import -url http://192.168.100.71:8181 -filename "C:\Packages\ NewTest.cmp" –nofilecompression

Import-SPWeb http://192.168.100.100:8181 -Path "C:\Packages\ NewTest.cmp" -UpdateVersions Overwrite

* Microsoft SharePoint Foundation Web Application Start

stsadm -o provisionservice -action start -servicetype spwebservice

* Solution Deployment Error:

.Retract solution via central admin / visual studio.
.Remove from central admin.
.Publish application ( generate .wsp )
.copy wsp and paste it. change extension from .wsp to .zip
.extract zip folder.
.copy feature folder @ C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\FEATURES
. install feature with force
stsadm -o installfeature -name "featureName1" -force
. uninstall feature with force
stsadm -o uninstallfeature -name "featureName1" -force
.add solution
stsadm -o addsolution -filename "C:\Responsive.wsp"
.deploy solution via central admin.
i deploysolution -name "Responsive.wsp" -url http://192.168.100.100:8181 -allowgacdeployment -immediate -force
.IISRESET

* Package Import Steps:

.Delete Site collection
.Create New Site Collection.
.Check Web.config Entries and dll placed in GAC.
.Change Site Collection administrator as per needed like add contoso\administrator & administrator as users.
.Deply All WSP into site.
.Import Package now.

X

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now