Admin SharePoint 2010 with PowerShell

Post on 15-Nov-2014

1.257 views 1 download

Tags:

description

 

Transcript of Admin SharePoint 2010 with PowerShell

Administering SharePoint 2010with Windows PowerShell

Don JonesConcentrated Technology, LLC

http://concentratedtech.com

This slide deck was used in one of our many conference presentations. We hope you enjoy it, and invite you to use it within your own

organization however you like.

For more information on our company, including information on private classes and upcoming conference appearances, please visit our Web

site, www.ConcentratedTech.com.

For links to newly-posted decks, follow us on Twitter:@concentrateddon or @concentratdgreg

This work is copyright ©Concentrated Technology, LLC

Agenda

• Our main goal is to explore what’s possible in SharePoint using Windows PowerShell…

• …and to start looking at the major command sets that accomplish administrative tasks

• We’ll spend a lot of time examining the Help files as part of this

CAUTION: DEMOS AHEAD

• This is a demonstration-intensive session (very few slides)

• I will capture a shell transcript and save all of my scripts

• You can download these (in a week or so) from ConcentratedTech.com (there’s a “Conference Materials” link in the menu)

SP Management Shell

• Not really an independent shell…• …just a “preloaded” Windows PowerShell• Loads a specific module/snapin at startup so

that SP commands are available• You could also manually load these into a

“normal” shell (or 3rd-party host)• Let’s see

Shell Admin Permissions

• Need to grant admins the right to use the management shell

• Get-SPShellAdmin• Add-SPShellAdmin –username DOMAIN\user

-database (Get-SPContentDatabase -Identity database_name)

• Remove-SPShellAdmin

Cmdlet Naming

• Notice the SP prefix on the noun of all SharePoint cmdlets?

• Get-Command –noun SP* • Or…• Get-Command limited to the SharePoint

module/snapin (let’s see)

START THINKING…

• What SP admin tasks would YOU want to automate within the shell?

• Your ideas will drive our discovery of commands and capabilities… so start coming up with ideas!

Starting Commands

• Get-SPSite (get site collections)• Get-SPWeb (get Webs)• Try this:

Get-SPSite –limit All |Get-SPWeb –limit All |Where { -not $_.RequestAccessEnabled }

Limits

• Most Get-SP* commands limit to 20 objects• Use –Limit to change that; either numeric or

“All.”• Be aware of potential performance issues with

large result sets – avoid doing so on production servers unless necessary

Filters

• Most Get-SP* commands also include a –filter parameter

• Limits the results to just those that meet the filter criteria

• Best way to filter – as opposed to using Where – if the property you want to filter on is supported

Supported Filters

Get-SPSite• Owner• Secondary Onwer• LockState

Get-SPWeb• Title• Template

Get-SPWeb –filter {$_.Template –eq ’Blog’ }

Farms

• Get-SPFarm• Get-SPFarmConfig• Backup-SPFarm• Restore-SPFarm

Servers

• Get-SPServer [[-Identity] name]• Get-SPServer |

Where { $_.Role –eq "Application" }

Web Applications

• New-SPWebApplication• Get-SPWebApplication• Remove-SPWebApplication

Sites

• New-SPSite• Get-SPSite• Get-SPSiteAdministration• Backup-SPSite• Remove-SPSite

Webs

• New-SPWeb• Get-SPWeb• Remove-SPWeb

NOW… let’s do some Q&A

• I’ve got more demos to show you, but want to make sure I address your questions

• Ask ‘em now!• The remainder of the session will be additional

demos• Remember: Transcript will be downloadable; no

need to copy down the syntax• Ask for a “reminder card” if you want to download

this stuff next week.

Final Notes…

• Please be sure to submit a session evaluation form!• Download slides & materials from

www.ConcentratedTech.com within one week!• Blog, URLs, and other information is also available at

www.ConcentratedTech.com for your reference• More resources at www.ShellHub.com • Thank you very much!

Your Feedback is Important

Please fill out a session evaluation form.

Thank you!

This slide deck was used in one of our many conference presentations. We hope you enjoy it, and invite you to use it within your own

organization however you like.

For more information on our company, including information on private classes and upcoming conference appearances, please visit our Web

site, www.ConcentratedTech.com.

For links to newly-posted decks, follow us on Twitter:@concentrateddon or @concentratdgreg

This work is copyright ©Concentrated Technology, LLC