Wednesday, June 3, 2015

Template Id for Sharepoint 2010


Base Type
Description
0
Generic List
1
Document Library
3
Discussion List
4
Survey
5
Issue List

The following table lists all available list templates with their template type id and their corresponding feature id:

Type of list
TemplateId
FeatureId 
 Generic List

100

00BFEA71-DE22-43B2-A848-C05709900100

 Document Library

101

00BFEA71-E717-4E80-AA17-D0C71B360101

 Survey

102

00BFEA71-EB8A-40B1-80C7-506BE7590102

 Links List

103

00BFEA71-2062-426C-90BF-714C59600103

 Announcements List

104

00BFEA71-D1CE-42de-9C63-A44004CE0104

 Contacts List

105

00BFEA71-7E6D-4186-9BA8-C047AC750105

 Events List

106

00BFEA71-EC85-4903-972D-EBE475780106

 Tasks List

107

00BFEA71-A83E-497E-9BA0-7A5C597D0107

 Discussion List

108

00BFEA71-6A49-43FA-B535-D15C05500108

 Picture Library

109

00BFEA71-52D4-45B3-B544-B1C71B620109

 Data Sources

110

00BFEA71-F381-423D-B9D1-DA7A54C50110

 Site template gallery

111



 User Information List

112



 Web Part gallery

113



 List Template gallery

114



 XML Form Library

115

00BFEA71-1E1D-4562-B56A-F05371BB0115

 Master Pages gallery

116



 No-Code Workflows

117

00BFEA71-F600-43F6-A895-40C0DE7B0117

 Custom Workflow Process

118

00BFEA71-2D77-4A75-9FCA-76516689E21A

 Wiki Page Library

119

00BFEA71-C796-4402-9F2F-0EB9A6E71B18

 Grid List

120

00BFEA71-3A1D-41D3-A0EE-651D11570120

 Data Connection Library

130

00BFEA71-DBD7-4F72-B8CB-DA7AC0440130

 Workflow History

140

00BFEA71-4EA5-48D4-A4AD-305CF7030140

 Gantt Task List

150

00BFEA71-513D-4CA0-96C2-6A47775C0119

 Meeting Series List

200



 Meeting Agenda List

201



 Meeting Attendees List

202



 Meeting Decision List

204



 Meeting Objectives List

207



Meeting Things to Bring List

211



 Meeting Workspace Pages List

212



 Blog Posts List

301



 Blog Comments List

302



 Blog Categories List

303



 Status Indicator (KPI) List

432

7ED6CD55-B479-4EB7-A529-E99A24C10BD3

 Report Library

433

6E53DD27-98F2-4AE5-85A0-E9A8EF4AA6DF

 Publishing Pages Library

850



 Issue Tracking List

1100

00BFEA71-5932-4F9C-AD71-1557E5751100

 Administrator Tasks List

1200



 Translation Management Library

1300

29D85C25-170C-4df9-A641-12DB0B9D4130

 Translation List

1301

29D85C25-170C-4df9-A641-12DB0B9D4130

Slide Library

2100

 

Enable NetBIOS & Update Feed Cache for User Profile Service Application

Enable NetBIOS for User Profile Service Application


$ServiceApps = Get-SPServiceApplication
$UserProfileServiceApp = ""
foreach ($sa in $ServiceApps)
{
if ($sa.DisplayName -eq "User Profile Service Application")
{$UserProfileServiceApp = $sa}
}
$UserProfileServiceApp.NetBIOSDomainNamesEnabled = 1
$UserProfileServiceApp.Update()

Gracefully remove distributed cache instance
Stop-SPDistributedCacheServiceInstance -Graceful
Remove-SPDistributedCacheServiceInstance


-------------------------------------------------------------------------------------------------------------------------------------------------------------------Update Feed Cache


$upa = Get-SPServiceApplication | where {$_.TypeName -Like "User Profile Service Application"}
$upa.FeedCacheTTLHours = 96
$upa.Update()

Stop Distributed cache host gracefully

## Settings you may want to change for your scenario ##
$startTime = Get-Date
$currentTime = $startTime
$elapsedTime = $currentTime - $startTime
$timeOut = 900

try
{
    Write-Host "Shutting down distributed cache host."
$hostInfo = Stop-CacheHost -Graceful -CachePort 22233 -ComputerName sp2013App.contoso.com

while($elapsedTime.TotalSeconds -le $timeOut-and $hostInfo.Status -ne 'Down')
{
     Write-Host "Host Status : [$($hostInfo.Status)]"
     Start-Sleep(5)
     $currentTime = Get-Date
     $elapsedTime = $currentTime - $startTime
     $hostInfo = Get-CacheHost -HostName SP2013app.contoso.com -CachePort 22233
}

Write-Host "Stopping distributed cache host was successful. Updating Service status in SharePoint."
Stop-SPDistributedCacheServiceInstance
Write-Host "To start service, please use Central Administration site."
}
catch [System.Exception]
{
Write-Host "Unable to stop cache host within 15 minutes."
}

Source:Microsoft Technet
It is always advised to stop DC service on SharePoint 2013 before a server is stopped/restarted as per one of the Premium case we worked with Microsoft.

Tuesday, June 2, 2015

Run SharePoint Cumulative Update using powershell

Run SharePoint Cumulative Update

if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null)
{
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}
###########################
##Ensure Patch is Present##
###########################
$patchfile = Get-ChildItem | where{$_.Extension -eq ".exe"}
if($patchfile -eq $null)
{
Write-Host "Unable to retrieve the file. Exiting Script" -ForegroundColor Red
Return
}


########################
##Stop Search Services##
########################
##Checking Search services##
$srchctr = 1
$srch4srvctr = 1
$srch5srvctr = 1

$srv4 = get-service "OSearch15"
$srv5 = get-service "SPSearchHostController"

If(($srv4.status -eq "Running") -or ($srv5.status-eq "Running"))
{
Write-Host "Choose 1 to Pause Search Service Application" -ForegroundColor Cyan
Write-Host "Choose 2 to leave Search Service Application running" -ForegroundColor Cyan
$searchappresult = Read-Host "Press 1 or 2 and hit enter"
Write-Host


if($searchappresult -eq 1)
{
$srchctr = 2
Write-Host "Pausing the Search Service Application" -foregroundcolor yellow
Write-Host "This could take a few minutes" -ForegroundColor Yellow
$ssa = get-spenterprisesearchserviceapplication
$ssa.pause()
}


elseif($searchappresult -eq 2)
{
Write-Host "Continuing without pausing the Search Service Application"
}
else
{
Write-Host "Run the script again and choose option 1 or 2" -ForegroundColor Red
Write-Host "Exiting Script" -ForegroundColor Red
Return
}
}

Write-Host "Stopping Search Services if they are running" -foregroundcolor yellow
if($srv4.status -eq "Running")
{
$srch4srvctr = 2
set-service -Name "OSearch15" -startuptype Disabled
$srv4.stop()
}

if($srv5.status -eq "Running")
{
$srch5srvctr = 2
Set-service "SPSearchHostController" -startuptype Disabled
$srv5.stop()
}

do
{
$srv6 = get-service "SPSearchHostController"
if($srv6.status -eq "Stopped")
{
$yes = 1
}
Start-Sleep -seconds 10
}
until ($yes -eq 1)

Write-Host "Search Services are stopped" -foregroundcolor Green
Write-Host



#######################
##Stop Other Services##
#######################
Set-Service -Name "IISADMIN" -startuptype Disabled
Set-Service -Name "SPTimerV4" -startuptype Disabled
Write-Host "Gracefully stopping IIS W3WP Processes" -foregroundcolor yellow
Write-Host
iisreset -stop -noforce
Write-Host "Stopping Services" -foregroundcolor yellow
Write-Host

$srv2 = get-service "SPTimerV4"
if($srv2.status -eq "Running")
{$srv2.stop()}

Write-Host "Services are Stopped" -ForegroundColor Green
Write-Host
Write-Host



##################
##Start patching##
##################
Write-Host "Patching now keep this PowerShell window open" -ForegroundColor Magenta
Write-Host
$starttime = Get-Date

$filename = $patchfile.basename
$arg = "/passive"

Start-Process $filename $arg

Start-Sleep -seconds 20
$proc = get-process $filename
$proc.WaitForExit()

$finishtime = get-date
Write-Host
Write-Host "Patch installation complete" -foregroundcolor green
Write-Host



##################
##Start Services##
##################
Write-Host "Starting Services Backup" -foregroundcolor yellow
Set-Service -Name "SPTimerV4" -startuptype Automatic
Set-Service -Name "IISADMIN" -startuptype Automatic

##Grabbing local server and starting services##
$servername = hostname
$server = get-spserver $servername

$srv2 = get-service "SPTimerV4"
$srv2.start()
$srv3 = get-service "IISADMIN"
$srv3.start()
$srv4 = get-service "OSearch15"
$srv5 = get-service "SPSearchHostController"

###Ensuring Search Services were stopped by script before Starting"
if($srch4srvctr -eq 2)
{
set-service -Name "OSearch15" -startuptype Automatic
$srv4.start()
}
if($srch5srvctr -eq 2)
{
Set-service "SPSearchHostController" -startuptype Automatic
$srv5.start()
}

###Resuming Search Service Application if paused###
if($srchctr -eq 2)
{
Write-Host "Resuming the Search Service Application" -foregroundcolor yellow
$ssa = get-spenterprisesearchserviceapplication
$ssa.resume()
}

Write-Host "Services are Started" -foregroundcolor green
Write-Host
Write-Host
Write-Host "Script Duration" -foregroundcolor yellow
Write-Host "Started: " $starttime -foregroundcolor yellow
Write-Host "Finished: " $finishtime -foregroundcolor yellow
Write-Host "Script Complete"

Write-Host "REMINDER: Run SharePoint Products Configuration Wizard on each server" -foregroundcolor green

Clear SharePoint Config Cache with PowerShell

Clear SharePoint Config Cache with PowerShell
Add-PSSnapin -Name Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue

Stop-Service SPTimerV4
$folders = Get-ChildItem C:\ProgramData\Microsoft\SharePoint\Config
foreach ($folder in $folders)
{
$items = Get-ChildItem $folder.FullName -Recurse
foreach ($item in $items)
{
if ($item.Name.ToLower() -eq "cache.ini")
{
$cachefolder = $folder.FullName
}

}
}
$cachefolderitems = Get-ChildItem $cachefolder -Recurse
foreach ($cachefolderitem in $cachefolderitems)
{
if($cachefolderitem -like "*.xml")
{
$cachefolderitem.Delete()
}

}

$a = Get-Content $cachefolder\cache.ini
$a = 1
Set-Content $a -Path $cachefolder\cache.ini

read-host "Do this on all your SharePoint Servers - and THEN press ENTER"
start-Service SPTimerV4