Brian Jackett: Managing SharePoint 2010 Farms with Powershell
Upcoming SlideShare
Loading in...5

Brian Jackett: Managing SharePoint 2010 Farms with Powershell






Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • Great work
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment
  • Explain and photos
  • Half presentation, half demos. Start out introduction to PowerShell, then get into SharePoint integration. Lots of slides, but move quickly through them.
  • Probably can align with 1 of these 3 categories. Try to cover content for everyone but focusing on the 100 level introductory content.
  • This is how I’m rating myself, hopefully these satisfy your goals as wellQuote adapted from Jeremiah Peschka, database application developer in Columbus, OH. Not sure if he borrowed from anyone.Will cover what a commandlet is later in presentation
  • Most stage performers and magicians have an assistant, so I have mine as well
  • Quick view of what PowerShell looks like. On left is a shot of my customized console screen after profile commands have run. Explain more later, but let’s me know if certain things are in place.
  • Show that Central Admin is aware when you run new PowerShell backups, go to restore page.

Brian Jackett: Managing SharePoint 2010 Farms with Powershell Brian Jackett: Managing SharePoint 2010 Farms with Powershell Presentation Transcript

  • Managing SharePoint 2010
    Farms With PowerShell
    Brian T. Jackett
    Sogeti USA
  • About Me
    • Senior Consultant at Sogeti USA
    • Microsoft BI and Collaboration Lead View slide
    • Blogger View slide
    • Twitter’er
    • PowerShell Enthusiast
    • Central Ohio SPUG Steering Committee
    • Frog lover
  • No naps scheduled after lunch, wha…?
  • Agenda
    • Introduction to PowerShell
    • Basic Usage
    • Demos
    • Integrate with SharePoint
    • More Demos
    • Have some fun
  • Why Are You In This Talk?
    • Completely new to SharePoint administration
    • Been using STSADM and need to learn PowerShell
    • Been using PowerShell and want to use on SharePoint
    Little bit of content for everyone
  • Quick Polls
    Is your role admin / developer / other?
    Have you used STSADM?
    Have you used PowerShell?
    • If yes, level of proficiency (low, medium, high)?
    Already working with SharePoint 2010?
  • Goals for this presentation…
    • Learn the following mantra
    “If you have to write/click twice then script/automate it”
    • Basics of PowerShell (independent of SharePoint)
    • Basic overview of SharePoint 2010 commandlets
  • My Assistants for the Afternoon
  • Breaking Open PowerShell
  • PowerShell Origins
    • Introduced in 2006
    • Originally codename Monad
    • Later renamed to Microsoft Shell (MSH)
    • Later renamed again to Windows PowerShell
    • Becoming a cornerstone tool for administration
    Exchange 2007
    SQL Server 2008
    … and now SharePoint 2010!!
    In 2010, your newest Swiss Army Knife in SP tool bag
  • What Is PowerShell?
    PowerShell is…
    • A command line shell
    • Object oriented
    Able to support .Net objects, not just text
    • Extensible
    • New scripting language
    Aims to be familiar to those writing VBscript or shell scripting like Unix, but simplified like command line
  • Screenshot Comparison to CMD
  • Brief Features Overview
    • Consistent syntax
    Shame on STSADM
    • Object oriented pipeline
    Able to pass object output from one cmdlet as input to next
    Ex. Get-ChildItem | Sort-Object -Property LastWriteTime
    • Built-in providers
    Talk to Active Directory, registry, WMI, etc. natively
    • Aliases
    Bridge the gap for Unix, VBScript, etc. users
    • Tab complete
    • Many more…
  • System Requirements
    Default installed on Windows 7 and Server 2008 R2
    Integrated Scripting Environment (ISE) optional role on Server 2008 R2
  • How To Use
    • Verb-Noun –parameter “Parameter value”
    Ex. Set-Location –Path C:/
    • Variables
    $variable_name = command
    • Case insensitive
  • How To Use
    Commandlets (or cmdlets)
    • Premade commands to handle basic functionality
    Ex. Get-Help; Invoke-Item; Write-Host
    • 400+ with V2
    Modules and snap-ins allow adding custom commandlets
    Scripts (.ps1)
    • Place commands into a script file for repeat use
  • How To Find Help
    • Get-Help [cmdlet [*]]
    • Get-Alias [cmdlet [*]]
    • (object) | Get-Member
    We’ll get to the pipe operator ‘|’ later
    • [] = optional
    • () = object or variable
  • When to Use
    Use PowerShell when…
    • a process must be consistent
    • a process must be performed for multiple workstations/users/etc
    • you don’t know the target that needs to be modified
    “If you have to write it twice, script it”
  • Security Considerations
    • By default, PowerShell is locked down to not run scripts
    Need to unlock with Set-ExecutionPolicy <level>
    6 levels of execution available
    Get-Help about_execution_policies
    • SharePoint requires permissions to run PowerShell
  • A Word about the Profile
    PowerShell Profile
    • Can pre-load aliases, shortcuts, variables, etc.
    • Good place to load needed assemblies
    • Accessed at $profile
    Easy to create: “new-item –type file –path <path>”
  • Enough Intro, Let’s Demo
  • Demo 1
    Simple commands with file system
    Tab complete
  • Power of the Pipe
  • Power of the Pipe
    The Pipe Operator “|”
    • Output from one command becomes input for the next
    • String together multiple commands
    Filtering Option
    • Sort-Object
    • Where-Object
    • Select-Object
  • Demo 2
    Piping commands to each other
  • Our Protégé is Walking
  • PowerShell Providers
    Able to natively talk to:
    • File System
    • Environment
    • Registry
    • Alias
    • Function
    • Variable
    • Certificate
    Get-PSProvider & Get-PSDrive
  • I know what you’re thinking…
    28 Slides and no demos about SharePoint yet…?!?
  • Accessing the SharePoint API
    • SharePoint Object Model Hierarchy
    • Know how to handle SPSite and SPWeb memory
    Start-SPAssignment –global
  • Finally PowerShell + SharePoint
  • Demo 3 – Site Hierarchy
    Access SharePoint Hierarchy
    Access object properties
  • SharePoint Backup
    • Script out a backup/restore procedure (STSADM)
    • Remove old backups
    • Determine size of largest backup
    • Schedule PowerShell commands
    PowerShell -command "& 'MyScript.ps1' “
    Place into a .cmd or .bat and schedule as usual
    Can programmatically call script based on output from others
  • SharePoint Backup
    • Script out a backup/restore procedure
    • Remove old backups
    • Determine size of largest backup
  • Scheduling PowerShell Scripts
    • Schedule PowerShell commands
    PowerShell -command "& 'MyScript.ps1' “
    Place into a .cmd or .bat and schedule as usual
    Can programmatically call script based on output from others
  • Demo 4 - Backups
  • SharePoint Site Administration
    Ideas to think about:
    • Activate/deactivate features
    • Set/unset master pages
    • Create/delete site
    • Check file sizes on site
    • Update list values
    • …sky is the limit
  • Demo 5 – Interacting Sites
    Create site
    Delete site
    Recursively traverse site hierarchy
    Enumerate site templates
  • Limit Server Results With –Filter Switch
    Typically you have this scenario
  • Limit Server Results With –Filter Switch
    Using –Filter limits results coming back from server
  • Demo 6 – Server Side Filter
    Filter SPWebs server side
  • See How Fast This Shell Can Go
  • Complex Scripts
    Multitask within one script
    • Reference site
    • Recursively traverse site hierarchy
    • Read SharePoint group membership
    • Determine Active Directory groups
    • Expand Active Directory groups to users
  • Demo 7 – Johnny 5 is Alive
    The laser show spectacular
  • Who’s Brain is Full Now?
  • New Features in V2
    PowerShell V2
    • PowerShell remoting
    • Integrated Scripting Environment (ISE)
    • Script debugging (breakpoints)
    • Background jobs
    • Modules
    • Get-Help –online
  • V2 Release Schedule
    • Ships with Windows 7 and Server 2008 R2
    Automatically installed by default
    • Downloadable for XP/Server 2003 and above
    Released end of Oct 2009 as Windows Management Framework
  • SharePoint 2010 Considerations
    PowerShell preferred command line tool over STSADM
    • STSADM is being depricated
    Means STSADM is supported, but start learning PowerShell
    • Over 500 cmdlets to integrate with SharePoint
    • SharePoint Management Console = PowerShell
    • Remoting allows administrate entire farm centrally
  • –Whatif and –Confirm clauses
    Appending “-whatif” to commandlet allows seeing potential outcome without executing
    Ex. Remove-SPWeb –urlhttp://site –whatif
    Appending “-confirm” prompts user for confirmation before executing
    Ex. Remove-SPWeb –urlhttp://site –confirm
  • Conclusion
    • PowerShell is a new scripting admin tool
    • Syntax and how to use
    • Basic demos for file system and SharePoint
    • Hopefully had a few laughs as well
  • References
    PowerShell Product Homepage
    PowerShell Script Center
    PowerShell Owner’s Manual (good intro walkthroughs)
    PowerShell Community
    PowerShell and SharePoint 2010
  • Q&A
  • Thank you for attending!
  • 2 ASUS Netbooks
    Also Some Books
    1 Typemock Isolator License
    A 2-5 Day Course from SetFocus on SharePoint
    Telerik RAD Controls Set
    1 DeliverPointWFE 2010 license (Worth $1500)
    1 BCS Meta Man license (Worth $1200)
    1 Lightning Conductor 2010 WFE license (Worth $800)
    1 Lightning Storm Forums license. (Worth $600)