How to get the template name in sharepoint using powershell

How to get the template name in sharepoint using powershell
Sometimes in Production we want to know the template name for the current site we 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/


Backup and Restore List in SharePoint Using PowerShell

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.


How to create a new content database in sharepoint using powershell

How to create a new content database in sharepoint using powershell
In this article we will know,how to create a new content database using power shell

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


Export and Import subsite in sharepoint using PowerShell

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