Top Banner
TITLE HERE: Title
20
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Power shell for sp admins

TITLE HERE:Title

Page 2: Power shell for sp admins

Rick Taylor

PowerShell for SharePoint Admins

Page 3: Power shell for sp admins

Who Am I?

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

The PowerfulThe PleasurableThe Indestructible

Rick Taylor

Slick Rick – if you’re nasty

Page 4: Power shell for sp 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: Power shell for sp admins

• What is Windows PowerShell • Windows PowerShell basics • Windows PowerShell scripts for SharePoint

administrators

Agenda

Page 6: Power shell for sp admins

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

What is Windows PowerShell?

Page 7: Power shell for sp admins

• Tool of choice for administering SharePoint from the command line.

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

• Better, Stronger, Faster…

Why do we care?

Page 8: Power shell for sp admins

• STSADM still available to support backwards compatibility

• Can leverage it in Windows PowerShell scripts• Whatever STSADM can do, Windows PowerShell can

do better!– More granular control for backup / restore.– Deploy Features in one fell swoop

What about STSADM?

Page 9: Power shell for sp admins

• cmdlet – pronounced "command-let“

– single function that can be used separately or combined with other cmdlets to perform complex tasks and automate administration

Windows PowerShell Basics

Page 10: Power shell for sp 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: Power shell for sp 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 12: Power shell for sp 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 13: Power shell for sp admins

CHECKING OUT WINDOWS POWERSHELL

DEMO

Page 14: Power shell for sp 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 15: Power shell for sp 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 16: Power shell for sp admins

• Sample Script:– $password = Read-Host "What is the password for

all accounts?" -assecurestring ; Get-Content usernames.txt | ForEach-Object {New-SPManagedAccount -password $password -username warrior\$_; Set-SPManagedAccount -identity $_ -autogenerate -confirm:$False}

Scripting Syntax

Syntax Description

$ Denotes a variable.

; Denotes completion of cmdlet, continue to next one.

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

ForEach-Object { } For each object, execute all the commands within the { }.

Page 17: Power shell for sp admins

THE 11 MOST USEFUL SHAREPOINT POWERSHELL CMDLETS

DEMO

Page 18: Power shell for sp admins

18

Top 11 Most Useful SharePoint PowerShell Cmdlets

1. Get-help2. Get-command3. Get-SPSite/SPWeb4. Move-SPSite5. Import-SPWeb6. Backup-SP*7. Restore-SP*8. New-SP*9. Remove-SP*10. Install-SPFeature/SPSolution11. Enable-SPFeature/TimerJob

Page 20: Power shell for sp 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