Monitoring and Maintaining SharePoint 2013 Server

13
MONITORING AND MAINTAINING SHAREPOINT SERVER Course: SharePoint 2013 for Administrators and IT Pro's | Akrura Technologies By : Isha Kapoor SharePoint MVP, Author, Trainer and Founder http:// www.akruratechnologies.com/ http://www.learningsharepoint.com/ | @ LearningSP SharePoint

Transcript of Monitoring and Maintaining SharePoint 2013 Server

MONITORING AND MAINTAINING SHAREPOINT SERVER

Course: SharePoint 2013 for Administrators and IT Pro's | Akrura Technologies

By : Isha Kapoor

SharePoint MVP, Author, Trainer and Founder

http://www.akruratechnologies.com/

http://www.learningsharepoint.com/ | @LearningSP

SharePoint

OUTLINE…• Introduction to STSADM

• Adding Solutions, Features using STSADM

• Backup\Restore and Import\Export using STSADM

• Introduction to Windows PowerShell

• Installing Solution packages (WSPs) using Windows PowerShell

• Advanced reporting and Analysis using Windows PowerShell

• Backup\Restore, Import\Export SharePoint sites using Windows PowerShell

• Configure diagnostic logging in SharePoint 2013

• Developer Dashboard in SharePoint 2013

INTRODUCTION TO STSADMWhat is STSADM?

All SharePoint Servers includes Stsadm tool for command-line administration of Office SharePoint Server servers and its sites. Stsadm is located at the following path on the drive where SharePoint & Products is installed:

%COMMONPROGRAMFILES%\microsoft shared\web server extensions\12\bin

What permissions are needed to use STSADM? You must be an administrator on the local computer to use Stsadm. It is recommended to run STSADM with Farm account to get full access to the commands. The tool STSADM must be run on the server itself.

STSADM Commands are made up of two parts

• Operation – These are SharePoint Operations that you will use to administrator sites\lists\libraries, permissions etc.

• Parameters – These are switches that can be used with Stsadm Operations.

Syntax :

-operation OperationName -parameter value

What are SharePoint Solution Packages?

Any component that you want to Install in a SharePoint server must be added as a Solution Package or a WSP package (that has an extension .wsp). A Solution package is generally made up of a set of files that defines the components being installed on the server. For example, a typical solution package can be for deploying a Custom WebPart, a Feature, a Custom Action etc.

A Solution package is a Single file but site admins can view Individual files in a .wsp by making a copy of it and renaming it as a .cab extension. Solution Store – Every SharePoint Farm has a Solution Store (also known as Solutions or Farm Solutions) where all the Solution packages or WSPs are installed. You can find the Solution Store in Central Admin under Operations.

Adding a Solution - Adding a Solution is done in two parts : Installing and Deploying.

Installing Solution - Installing a Solution means adding it in a Solutions store on the farm. An STSADM Command addsolution is generally used to add a Solution into a Solution store.

stsadm -o addsolution -filename <solution file path>

Deploying Solution - Deploying a Solution means scoping a solutions to one or more Web applications. An STSADM Command deploysolution is generally used to deploy a Solution to one or more Web applications.

stsadm -o deploysolution -name <solution name> -url <URL of Web application>   [-allowgacdeployment]

ADDING SOLUTIONS, FEATURES USING STSADM

What are Features?

Every Solution package that deploys a component contains a Feature for that Component.

In simple words, A Feature defines the component and a solution package bundles up a feature and all the supporting files that needs to be deployed.

Feature Scope - A feature can be scoped to the following • Farm• Web application• Site Collection• Site

Adding a Feature - Adding a Feature is done in two parts : Installing and Activating.

Installing Feature - Installing a Feature makes its definition and elements known throughout a server farm.

stsadm -o addsolution -filename <solution file path>

Farm-scoped features are also automatically activated during this stage.

Activating Feature - Activating the Feature makes the Feature available at a particular scope.

stsadm -o activatefeature {-filename <path to Feature.xml> | -name <feature folder> }  -url <URL of Web application\Site Collection>

ADDING FEATURES USING STSADM

BACKUP\RESTORE AND IMPORT\EXPORT USING STSADM

Backup\Restore - STSADM backup\restore are popular commands used for backup and restore of a SharePoint site collection or a Web application.

Syntax :

stsadm -o backup -url <URL of Web application> -filename <backup file path extension .bak>

stsadm -o restore -url <URL of Web application> -filename <backup file path extension .bak>

Benefits - • Moving a Site Collection from one Content database to another.• With Backup\Restore stsadm command all SharePoint Designer Workflows gets moved without any issues.• Moving a Site Collection with Backup\Restore stsadm command, the actual Content get moved. That means it leaves behind the heavy

Audit Logs, Workflow history list etc.

Import\Export - STSADM Import\Export Commands are generally used to move a Subsite or Web but it can also export a site collection, web application or even a list.

Syntax :

stsadm -o export -url <URL of Web application> -filename <backup file path>

stsadm -o import -url <URL of Web application> -filename <backup file path>

STSADM BACKUP/RESTORE VS IMPORT\EXPORT

Stsadm backup/restore Stsadm export/import

Backup\Restore a Site Collection or a Web application. Exports data of a Subsite, site collection, an entire web application, or a single list.

The GUID of all items in a Site Collection is preserved except the GUID of the Site collection itself. When you restore the backup, SharePoint generates a new GUID for the site collection.

It generates a new GUID for every objects such as sites, sub sites, lists and items.

Because of the same Guid, you can restore in the same web application or farm but in a different Content database.

Because of the new Guid, you can restore or import the data in the same site collection\site or web application and it does not matter on which content database you run import operation.

This operation is designed to take an exact copy of a site collection, no data will be changed, transformed or lost.

This operation is good for merging content of sites, and decide how to handle identical data between source and target.

All workflows instances, associations, history and tasks are preserved.

A major drawback of this operation is that it does not preserves workflows instances, associations, history and tasks. Every workflow association must be recreated and there is no way to restore the running instances from original site.

INTRODUCTION TO WINDOWS POWERSHELL

What is Windows PowerShell?“Windows PowerShell is a command-line scripting tool that provides an administrator full access to applicable application programming interfaces (APIs). Administrators can use Windows PowerShell to interact directly with SharePoint-based web applications, site collections, sites, lists, and more.

To run SharePoint Commands with PowerShell you need to add the below SharePoint Snap-In first.Add-PSSnapin Microsoft.SharePoint.Powershell

What permissions are needed to use PowerShell? A user must be a member of the SharePoint_Shell_Access role on the configuration database and a member of the WSS_ADMIN_WPG local group on the computer where SharePoint is installed.

PowerShell Commands can be made up the following :

Get-Command - The Get-Command cmdlet gets commands in the session, such as aliases, functions, filters, scripts, and applications.

Get-Member - The Get-Member cmdlet gets the "members" (properties and methods) of objects.

Get-Help - The Get-Help cmdlet displays information about Windows PowerShell concepts and commands, including cmdlets, providers, functions, aliases and scripts. To get a list of all cmdlet help topic titles, type get-help *

Pipelines - PowerShell uses Pipelines to filter commands and display the desired results. When you “pipe” an object from one part of a command to another, you’re simply passing that object - unchanged - from one part of the command to another.

For Complete SharePoint 2013 PwerShell cmdlets list see : http://technet.microsoft.com/library/ff678226%28office.15%29.aspx

Examples of Get-Command

Get-SPWebApplication - The Get-SPWebApplication cmdlet returns all Web applications that match the scope given by the Identity parameter. The Identity can be the name of the name, URL, or GUID of the Web application. If no Identity is specified, all Web applications are returned.

Get-SPWebApplication -Identity <URL of Web application>

Get-SPSite - Returns all site collections that match the specified criteria. Get-SPSite -Identity <URL of Site Collection>

* -Identity specifies the Name, URL, or GUID of the Item* -Limit All displays all results instead of a limited items.

Example : To get all Site Collections of a Web Application.

Get-SPWebApplication <URL of Web application> | Get-SPSite -Limit All

Example : To get all SubSites in a all Site Collections of a Web Application.

Get-SPWebApplication <URL of Web application> | Get-SPSite -Limit All | Get-SPWeb -Limit All

If you have to get Subsites for a Specific Site Collection in a Web application, then use Where Object for a Command in a Pipe.

Get-SPWeb - Returns all Subsites in a Site collection that match the specified criteria.

Get-SPWeb -site <URL of Site Collection>

Examples of Pipelines

Select Pipeline : Lets you select the properties of an Object

Get-SPSite | select url, Title

Get-SPSite | get-member

Where-Object Pipeline :

Get-SPSite -Limit All | Where-Object {$_.Url -eq “<URL of Site Collection>”}

Get-SPSite -Limit All | Where-Object {$_.Url -like “* SiteColl”} | Get-SPWeb -Limit All | select url, Title

$sites = Get-SPSite | select url, Title | Where-Object {$_.Url -like "* SiteColl"}foreach ($site in $sites) { Write-Host $site}

ForEach-Object Pipeline :

Get-SPSite -Limit All | ForEach-Object {$_.URL, ($_.Usage.Storage/1024/1024)} Get-SPSite -Limit All | ForEach-Object {$_.URL, ($_.Quota.StorageMaximumLevel/1000000)}

Output Options -

| Out-string C:\output.csv| Out-GridView -Title “Window Name”

INSTALLING SOLUTION PACKAGES (WSPS) USING WINDOWS POWERSHELL

Add-SPSolution - Uploads a SharePoint solution package to the farm.

Add-SPSolution -LiteralPath c:\solution.wsp

Install-SPSolution - Deploys an installed SharePoint solution in the farm.

Install-SPSolution -Identity solution.wsp -GACDeployment -CompatibilityLevel {14,15}

ADVANCED REPORTING AND ANALYSIS USING WINDOWS POWERSHELL

Examples -

Get all Sites where URL contains the word IT

$sites = Get-SPSite | Where-Object {$_.Url -like "*IT*"}

foreach ($site in $sites) {

Write-Host "Site is SPSite Url=$site"

To report usage and quota of your site collections:

Get-SPSite | Select URL, @{Name=”Storage”; Expression={“{0:N2} MB” -f($_.Usage.Storage/1000000)}}, @{Name=”Quota”; Expression={“{0:N2} MB” -f($_.Quota.StorageMaximumLevel/1000000)} } | Out-GridView -Title “Sites with Usage”

WE ARE HERE TO HELP.

Questions?