27
Rick Taylor PowerShell for SharePoint Admins

PowerShell for SharePoint Admins

Embed Size (px)

DESCRIPTION

What is Windows PowerShell Windows PowerShell basics Windows PowerShell scripts for administrators

Citation preview

Page 1: PowerShell for SharePoint Admins

Rick Taylor

PowerShell for SharePoint Admins

Page 2: PowerShell for SharePoint Admins

3 | SharePoint Saturday New York City 2011

Housekeeping Please remember to visit the ATE & Open

Spaces for a chance to win an XBOX/Kinect. You can also enter into a raffle for an SPC Pass if you visit the sponsor booths to get your bingo card signed. All other prizes are related to ending session evaluations.

Follow SharePoint Saturday New York City on Twitter @spsnyc and hashtag #spsnyc

Page 3: PowerShell for SharePoint Admins

4 | SharePoint Saturday New York City 2011

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 4: PowerShell for SharePoint Admins

Agenda

What is Windows PowerShell Windows PowerShell basics Windows PowerShell scripts for

administrators

Page 5: PowerShell for SharePoint Admins

6 | SharePoint Saturday New York City 2011

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 6: PowerShell for SharePoint Admins

7 | SharePoint Saturday New York City 2011

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 7: PowerShell for SharePoint Admins

8 | SharePoint Saturday New York City 2011

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 8: PowerShell for SharePoint Admins

9 | SharePoint Saturday New York City 2011

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

Windows PowerShell Basics

Page 9: PowerShell for SharePoint Admins

10 | SharePoint Saturday New York City 2011

Windows PowerShell Basics cmdlets = verbs (actions) & nouns (objects) Combine the two to build specific commands Examples

Get-SPSite Get = Verb SPSite = Noun

Page 10: PowerShell for SharePoint Admins

11 | SharePoint Saturday New York City 2011

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 11: PowerShell for SharePoint Admins

12 | SharePoint Saturday New York City 2011

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 12: PowerShell for SharePoint Admins

13 | SharePoint Saturday New York City 2011

Differences in Get-help: -full

Page 13: PowerShell for SharePoint Admins

14 | SharePoint Saturday New York City 2011

Differences in Get-help: -detailed

Page 14: PowerShell for SharePoint Admins

15 | SharePoint Saturday New York City 2011

Differences in Get-help: -examples

Page 15: PowerShell for SharePoint Admins

CHECKING OUT WINDOWS POWERSHELLDEMO

Page 16: PowerShell for SharePoint Admins

17 | SharePoint Saturday New York City 2011

Build scripts to easily execute through common commands and tasks

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

PowerShell Scripts

Page 17: PowerShell for SharePoint Admins

18 | SharePoint Saturday New York City 2011

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 18: PowerShell for SharePoint Admins

19 | SharePoint Saturday New York City 2011

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 19: PowerShell for SharePoint Admins

WINDOWS POWERSHELL SCRIPTS IN SHAREPOINT

DEMO

Page 20: PowerShell for SharePoint Admins

21 | SharePoint Saturday New York City 2011

Slick Rick’s Picks

Page 22: PowerShell for SharePoint Admins
Page 23: PowerShell for SharePoint Admins

Slide Title Here

Verdana 16 or 14 pt bold

Verdana 14 or 12 pt

Stock photography images are available for use here:

https://wiki.perficient.com/confluence/display/mktg/Stock+Images

Page 24: PowerShell for SharePoint Admins

Section Break/Divider Slide

Page 25: PowerShell for SharePoint Admins

26 | SharePoint Saturday New York City 2011

Outline & Agenda

Page 26: PowerShell for SharePoint Admins
Page 27: PowerShell for SharePoint Admins

Thanks to Our Sponsors!Enterprise

Standard

Foundation

Office 365

Prize