Wednesday, April 16, 2014

Save site as Templete using PowerShell

You can create site template using SharePoint site setting UI. alternatively you could PowerShell

$Web=Get-SPWeb http://sp2013.com/sites/template
$Web.SaveAsTemplate("Template Name","Template Title","Template Description",1)

If you want to save specified site as template along with data use 1, otherwise use 0 in forth parameter of SaveAsTemplate().

After running above commands, the newly created template will be available in site collection "Solutions" gallery.

ReDeploy Custom Timer Job using PowerShell

Following are the steps you need to redeploy a custom timer job.

Disable-SPFeature -Identity "91b81920-cc93-46da-b2c9-7e29c5077a67" -Url "http://sp2013.com/"
UnInstall-SPFeature -Identity "91b81920-cc93-46da-b2c9-7e29c5077a67"

Uninstall-SPSolution -Identity TimerJob.wsp –allwebapplications
Remove-SPSolution TimerJob.wsp –force

Add-spsolution C:\temp\TimerJob.wsp
Install-spsolution TimerJob.wsp -GACDeployment –force

Enable-SPFeature -Identity "91b81920-cc93-46da-b2c9-7e29c5077a67" -Url "http://sp2013.com/" –PassThru

Stop-Service SPTimerV4
Start-Service SPTimerV4

If you use update solution TimerJob may not pickup updated functionality
//Update-SPSolution -Identity timerjob.wsp -LiteralPath C:\temp\TimerJob.wsp -GACDeployment

GAC Install a DLL using PowerShell

Installed assembly into GAC -

Set-location "c:\temp"
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacInstall("C:\temp\Mydll.dll")
iisreset

To Get assembly info-
([system.reflection.assembly]::loadfile("C:\temp\Mydll.dll")).FullName

SharePoint 2013 URLs

We can access SharePoint pages using their shortcuts URLs

Add Web Parts Pane -  ?ToolPaneView=2
Add web parts to any page -  ?PageView=Shared&ToolPaneView=2
Create Alerts on this Site -  _layouts/15/SubChoos.aspx
Create New new list, library etc - _layouts/15/create.aspx
Create New Site -  _layouts/15/NewsbWeb.aspx
Create New Web Part Page -  _layouts/15/spcf.aspx
Edit Alerts - _layouts/15/SubEdit.aspx
List Template Gallery -  _catalogs/lt/Forms/AllItems.aspx
Login as another user - /_layouts/closeConnection.aspx?loginasanotheruser=true
Manage People -  _layouts/15/people.aspx
Manage Permissions - _layouts/15/user.aspx
Manage SiteCollection Administrators -  _layouts/15/mngsiteadmin.aspx
Manage Sites and Workspaces - _layouts/15/mngsubwebs.aspx
Master Page Gallery -  _catalogs/masterpage/Forms/AllItems.aspx
Modify Navigation -  _layouts/15/AreaNavigationSettings.aspx
Navigation Settings -  _layouts/15/SiteNavigationSettings.aspx
Recycle Bin - _layouts/15/AdminRecycleBin.aspx
Save Site as Template -  _layouts/15/savetmpl.aspx
Site Column Gallery - _layouts/15/mngfield.aspx
Site Content and Structure Manager - _layouts/15/sitemanager.aspx
Site Content Types - _layouts/15/mngctype.aspx
Site Directory - _layouts/15/SiteDirectorySettings.aspx
Site Settings page -  _layouts/15/settings.aspx
User Alerts -_layouts/15/sitesubs.aspx
User Information List - _catalogs/users/simple.aspx
View All Site Content - _layouts/15/viewlsts.aspx
Web Part Gallery -  _catalogs/wp/Forms/AllItems.aspx
Web part maintenance mode -  ?contents=1 to Page URL
Web Analytics Reports Summary - _layouts/15/usage.aspx