PowerShell for SharePoint Admins

24
Rick Taylor PowerShell for SharePoint Admins

description

 

Transcript of PowerShell for SharePoint Admins

Page 1: PowerShell for SharePoint Admins

Rick Taylor

PowerShell for SharePoint Admins

Page 2: PowerShell for SharePoint Admins

Thank you to Sponsors!

Page 3: PowerShell for SharePoint Admins

• Who am I???• Who am I ??????????The Guardian of Lost Souls

The Powerful

The PleasurableThe Indestructible

Rick Taylor

Slick Rick – if you’re nasty

Page 4: PowerShell for SharePoint Admins

• Rick Taylor, MCSE, MCT

[email protected]– SharePoint architect, formerly with Microsoft SharePoint

Platform Architecture Team for SharePoint Online– Contact

• http://blogs.technet.com/ritaylor• Twitter: @SLKRCK

Page 5: PowerShell for SharePoint Admins

Agenda

• What is Windows PowerShell• Why should you know PowerShell• Windows PowerShell basics • Windows PowerShell scripts for

administrators

Page 6: PowerShell for SharePoint Admins

• Command-line interface and scripting language used for SharePoint Server administration– Complements CMD– Extends STSADM– Uses XML & Objects– Built on the .Net Framework

What is Windows PowerShell?

Page 7: PowerShell for SharePoint Admins

• Complete command-line system that is far more powerful than any previous Windows-based command-line prompt environment.

• Provides:– More Control– More Efficiency– More Productivity

Why do we care?

Page 8: PowerShell for SharePoint Admins

• STSADM still available to support backwards compatibility• Can leverage it in Windows PowerShell scripts

• There are still some things that STSADM can do, that Windows PowerShell cannot, so you still need it!– Ability to run against SQL Snapshots, instead of production.– More granular control for backup / restore.

What about STSADM?

Page 9: PowerShell for SharePoint Admins

• cmdlet – pronounced "command-let“– More than 500 cmdlets for SharePoint alone

Windows PowerShell Basics

Page 10: PowerShell for SharePoint Admins

Windows PowerShell Basics• cmdlets = verbs (actions) & nouns (objects)

– Combine the two to build specific commands– Examples

• Get-SPSite• Get = Verb • SPSite = Noun

Page 11: PowerShell for SharePoint Admins

Windows PowerShell BasicsVerb Operation

Get- Enumerate

New-(static cmdlet)

Create

Set-

Modify

Remove- Delete

Page 12: PowerShell for SharePoint Admins

• Get a list of all commands:– Get-Command –noun sp*

• Get help for a specific command:– Get-Help <cmdlet>

Getting the list of SharePoint cmdlets

Page 13: PowerShell for SharePoint Admins

• For more detailed help add the following parameters:

– Get-Help <cmdlet> -full

– Get-Help <cmdlet> -examples

– Get-Help <cmdlet> -detailed

Getting the list of SharePoint cmdlets

Page 14: PowerShell for SharePoint Admins

Differences in Get-help: -full

Page 15: PowerShell for SharePoint Admins

Differences in Get-help: -detailed

Page 16: PowerShell for SharePoint Admins

Differences in Get-help: -examples

Page 17: PowerShell for SharePoint Admins

CHECKING OUT WINDOWS POWERSHELL

DEMO

Page 18: PowerShell for SharePoint Admins

• Build scripts to easily execute through common commands and tasks

• Develop using PowerShell ISE or other shells• Schedule using Task Scheduler.

PowerShell Scripts

Page 19: PowerShell for SharePoint Admins

• Examples:– Activate a feature across multiple site collections– Provisioning of Managed Accounts– Creating of New Sites– Backup all Site Collections in Farm

PowerShell Scripts

Page 20: PowerShell for SharePoint Admins

• Sample Script:$LsaPath = "HKLM:\System\CurrentControlSet\Control\Lsa"$LsaPathValue = Get-ItemProperty -path $LsaPathIf (-not ($LsaPathValue.DisableLoopbackCheck -eq "1")){New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name "DisableLoopbackCheck" -value "1" -PropertyType dword -Force | Out-Null}

Scripting Syntax

Syntax Description

$ Denotes a variable.

Denotes typing on the same line.

| Sends the output of the preceding cmdlet to the next cmdlet.

If ( ) Evaluate condition in ( ) and execute if true.

Page 21: PowerShell for SharePoint Admins

WINDOWS POWERSHELL SCRIPTS IN SHAREPOINT

DEMO

Page 22: PowerShell for SharePoint Admins

Slick Rick’s Picks

Page 23: PowerShell for SharePoint Admins

SharePoint Community in Philadelphia

• Tri-State SharePoint Users Group– SharePoint (2010 & 2007)

• Administrators• Developers• IT Pros

– Keynote and related Hands-on Lab each meeting– “On SharePoint Development”

• Our lecture series on general SharePoint Development topics and how to improve those skills

– Meetings: 2nd Tuesday of the month, 5:30pm – 9:00pm, Microsoft Malvern MTC

• Website: www.TriStateSharePoint.org• Email: [email protected]• Twitter: @tristateSP