Tuesday, 22 July 2014

How to get the template name in sharepoint using powershell

Sometimes in Production we want to know the template name for the current site you are using.
Using below Power Shell we can find the Template name easily.

$currentweb = Get-SPWeb  http://DotNetSharePoint:1234/sites/Sharepoint
write-host "Web Template:" $currentweb.WebTemplate " | Web Template ID:" $currentweb.WebTemplateId
$currentweb.Dispose()

OutPut:Web Template: STS | Web Template ID: 1 // For Team Site

Site Template ID with Name:
0 - GLOBAL (SetupPath=global) - "Global template"
1 - STS - "windows SharePoint Services Site", "Team Site", "Blank Site", "Document Workspace"
2 - MPS - "Basic Meeting Workspace", "Blank Meeting Workspace", "Decision Meeting Workspace", "Social Meeting Workspace", "Multipage Meeting Workspace"
3 - CENTRALADMIN - "Central Admin Site"
4 - WIKI - "Wiki Site"
7 - BDR - "Document Center"
9 - BLOG - "Blog"
20 - SPS (OBSOLETE) - "SharePoint Portal Server Site"
21 - SPSPERS - "SharePoint Portal Server Personal Space"
22 - SPSMSITE - "Personalization Site"
30 - SPSTOC (OBSOLETE) - "Contents area Template"
31 - SPSTOPIC (OBSOLETE) - "Topic area template"
32 - SPSNEWS (OBSOLETE) - "News area template"
33 - SPSNHOME (SubWebOnly) - "News Home template"
34 - SPSSITES - "Site Directory area template"
36 - SPSCOMMU (OBSOLETE) - "Community area template"
38 - SPSREPORTCENTER - "Report Center Site"
39 - CMSPUBLISHING (SetupPath=SiteTemplates\PUBLISHING) - "Publishing and Team Collaboration Site"
40 - OSRV (SetupPath=SiteTemplates\OSRV) - "Shared Services Administration Site"
47 - SPSPORTAL - "Corporate Intranet Site"
50 - SRCHCEN - "Search Center"
51 - PROFILES - "Profiles"
52 - BLANKINTERNETCONTAINER - "Internet Presence Web Site"
53 - BLANKINTERNET - "Publishing Site", "Press Releases Site", "Publishing Site"
54 - SPSMSITEHOST - "My Site Host"
90 - SRCHCENTERLITE (SetupPath=SiteTemplates\SRCHCENTERLITE) - "Search Center Lite"
6221 - PWA (SetupPath=SiteTemplates\PWA) - "Project Web Access Site"
6215 - PWS (SetupPath=SiteTemplates\PWS) - "Project Workspace"
14483 - OFFILE - "Records Repository", "Records Repository"

Reference Template ID's from  http://social.technet.microsoft.com/

SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

Saturday, 5 July 2014

Backup and Restore List in SharePoint Using PowerShell

Some times we have to take the Backup for List with data form one site collection to another site collection  using power shell, we can do our task simply
I am having a list with name "DotNetSharePoint" we have to refer the List with /Lists/YourListName.

Taking Back Up List from One Site Collection
Export-SPWeb "Site Url" -itemurl "/Lists/YourListName" -Path "YourPath"
Example:
Export-SPWeb -Identity "http://SharePoint:6789/sites/DotNet" -Itemurl "/Lists/DotNetSharePoint" -Path "c://DotNetSharePoint.cmp"

Restoring the Backup List to Another Site Collection.

Import-SPWeb -Identity "Site Url" -Path "YourPath" -force
Example:
Import-SPWeb -Identity "http://DotNetSharePoint:1234/sites/SharePoint" -Path "c://DotNetSharePoint.cmp" -force

"-force"  is used to overtire the existing list having the same name.

SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

Friday, 4 July 2014

How to create a new content database in sharepoint using powershell

Using New-SPContentDatabase  Create a new content database and attach it to the web application

New-SPContentDatabase "yourdatabasename" -DatabaseServer "yourdbservername" -WebApplication http://yoursitename

Example
New-SPContentDatabase "DotNetSharePointDB" -DatabaseServer "DotNetSharePoint" -WebApplication http://dotnetsharepoint:1234

Also we can keep the Maximum Number of Site Collections and Site Collection Level Warning using -MaxSiteCount and -WarningSiteCount

New-SPContentDatabase "DotNetSharePointDB" -DatabaseServer "DotNetSharePoint" -WebApplication http://dotnetsharepoint:1234 -MaxSiteCount 2 -WarningSiteCount  1

SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

Export and Import subsite in sharepoint using PowerShell

Using PowerShell we can do Export and Import subsite's in sharepoint  using  PowerShell

Export-SPWeb yoursiteurl –Path "YourPathwith CMPName" -includeusersecurity 
Example
 Export-SPWeb http://dotnetsharepoint.com/sites/dotnet/dotnetsharepoint/ –Path "C:\BackUp\DotNetSharePoint.cmp" -includeusersecurity  

Import-SPWeb yoursiteurl -Path "YourPathwith CMPName"  -IncludeUserSecurity -Force
Example                        
Import-SPWeb http://dotnetsharepoint.com/sites/dotnet/sharepoint/ -Path "C:\SiteBackUp\DotNetSharePoint.cmp"  -IncludeUserSecurity -Force

-IncludeUserSecurity
To get the Users with Groups and Permissions

-Force
Is used to over write the existing site

SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

Friday, 27 June 2014

How to deploy WSP Globally in SharePoint Using PowerShell

Using Power Shell Deploying the WSP Globally in SharePoint Environment

Add Solution Package to the Server

Add-SPSolution  C:\DotNetSharePoint.WSP

Deploying WSP Globally

Install-SPSolution  DotNetSharePoint.WSP  -GACDeployment

Uninstall the WSP from the Server

Uninstall-SPSolution –identity DotNetSharePoint.WSP

Remove the WSP from the Server

Remove-SPSolution –identity DotNetSharePoint.WSP

SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

Thursday, 26 June 2014

How to update existing WSP in sharepoint Farm using PowerShell

Using PowerShell with out retracting the existing WSP i am updating the new WSP in SharePoint Farm


Update-SPSolution –Identity yourwspname.wsp –LiteralPath "WSP Path" –GacDeployment

Update-SPSolution –Identity DotNetSharePoint.wsp –LiteralPath "C:\DotNetSharePoint.wsp" –GacDeployment


SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM

Enabling or Disabling the Claims Based Authencation using PowerShell

Web application is already provisioned with classic,there is no GUI option to change the classic mode to claims but using power shell we can do it.

In Central Admin->Application Management->Manage Web application

Select the particular web application in top ribbon click on the Authentication Providers,there we can see the membership provider name Claims or Classic.

     

Now i am changing the classic to claims using the below power shell

$claims = Get-SPWebApplication "http://DotNetSharePoint:23456/"
$claims.UseClaimsAuthentication = 1;
$claims.Update()

Again i am changing the claims to classic using the below power shell

                               
$claims = Get-SPWebApplication "http://DotNetSharePoint:23456/"
$claims.UseClaimsAuthentication = 0;
$claims.Update()

SharePoint Online Real Time Training Contact: JLAKSHMITULASI@GMAIL.COM