Your SlideShare is downloading. ×
0
Managing SharePoint 2010<br />Farms With PowerShell<br />Brian T. Jackett<br />Sogeti USA<br />www.BrianTJackett.com<br />...
About Me<br /><ul><li>Senior Consultant at Sogeti USA
Microsoft BI and Collaboration Lead
Blogger
Twitter’er
PowerShell Enthusiast
Central Ohio SPUG Steering Committee
Frog lover</li></li></ul><li>No naps scheduled after lunch, wha…?<br />
Agenda<br /><ul><li>Introduction to PowerShell
Basic Usage
Demos
Integrate with SharePoint
More Demos
Have some fun</li></li></ul><li>Why Are You In This Talk?<br /><ul><li>Completely new to SharePoint administration
Been using STSADM and need to learn PowerShell
Been using PowerShell and want to use on SharePoint</li></ul>Little bit of content for everyone<br />
Quick Polls<br />Is your role admin / developer / other?<br />Have you used STSADM?<br />Have you used PowerShell?<br /><u...
Goals for this presentation…<br /><ul><li>Learn the following mantra</li></ul>“If you have to write/click twice then scrip...
Basic overview of SharePoint 2010 commandlets</li></li></ul><li>My Assistants for the Afternoon<br />
Breaking Open PowerShell<br />
PowerShell Origins<br /><ul><li>Introduced in 2006
Originally codename Monad
Later renamed to Microsoft Shell (MSH)
Later renamed again to Windows PowerShell
Becoming a cornerstone tool for administration</li></ul>Exchange 2007<br />SQL Server 2008<br />… and now SharePoint 2010!...
What Is PowerShell?<br />PowerShell is…<br /><ul><li>A command line shell
Object oriented</li></ul>Able to support .Net objects, not just text<br /><ul><li>Extensible
New scripting language</li></ul>Aims to be familiar to those writing VBscript or shell scripting like Unix, but simplified...
Screenshot Comparison to CMD<br />
Brief Features Overview<br /><ul><li>Consistent syntax</li></ul>Shame on STSADM<br /><ul><li>Object oriented pipeline</li>...
Many more…</li></li></ul><li>System Requirements<br />Default installed on Windows 7 and Server 2008 R2<br />Integrated Sc...
How To Use<br />Syntax<br /><ul><li>Verb-Noun –parameter “Parameter value”</li></ul>Ex. Set-Location –Path C:/<br /><ul><l...
How To Use<br />Commandlets (or cmdlets)<br /><ul><li>Premade commands to handle basic functionality</li></ul>Ex. Get-Help...
Get-Alias [cmdlet [*]]
(object) | Get-Member</li></ul>We’ll get to the pipe operator ‘|’ later<br /><ul><li>[] = optional
() = object or variable</li></li></ul><li>When to Use<br />Use PowerShell when…<br /><ul><li>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</li></ul>“If you have to write it twice, script it”<br />
Security Considerations<br /><ul><li>By default, PowerShell is locked down to not run scripts</li></ul>Need to unlock with...
A Word about the Profile<br />PowerShell Profile<br /><ul><li>Can pre-load aliases, shortcuts, variables, etc.
Good place to load needed assemblies
Accessed at $profile</li></ul><docs>WindowsPowerShellMicrosoft.PowerShell_profile<br /><docs>WindowsPowerShellMicrosoft.Po...
Enough Intro, Let’s Demo<br />
Demo 1<br />Get-Help<br />Get-Member<br />Simple commands with file system<br />Get-Alias<br />Tab complete<br />
Power of the Pipe<br />
Power of the Pipe<br />The Pipe Operator “|”<br /><ul><li>Output from one command becomes input for the next
String together multiple commands</li></ul>Filtering Option<br /><ul><li>Sort-Object
Where-Object
Select-Object</li></li></ul><li>Demo 2<br />Piping commands to each other<br />Sort<br />Select<br />Where<br />
Our Protégé is Walking<br />
PowerShell Providers<br />Able to natively talk to:<br /><ul><li>File System
Environment
Upcoming SlideShare
Loading in...5
×

Brian Jackett: Managing SharePoint 2010 Farms with Powershell

2,756

Published on

1 Comment
1 Like
Statistics
Notes
No Downloads
Views
Total Views
2,756
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
41
Comments
1
Likes
1
Embeds 0
No embeds

No notes for slide
  • Explain ICanHasCheeseburger.com 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.
  • Transcript of "Brian Jackett: Managing SharePoint 2010 Farms with Powershell"

    1. 1. Managing SharePoint 2010<br />Farms With PowerShell<br />Brian T. Jackett<br />Sogeti USA<br />www.BrianTJackett.com<br />@BrianTJackett<br />Brian.Jackett@us.sogeti.com<br />
    2. 2. About Me<br /><ul><li>Senior Consultant at Sogeti USA
    3. 3. Microsoft BI and Collaboration Lead
    4. 4. Blogger
    5. 5. Twitter’er
    6. 6. PowerShell Enthusiast
    7. 7. Central Ohio SPUG Steering Committee
    8. 8. Frog lover</li></li></ul><li>No naps scheduled after lunch, wha…?<br />
    9. 9. Agenda<br /><ul><li>Introduction to PowerShell
    10. 10. Basic Usage
    11. 11. Demos
    12. 12. Integrate with SharePoint
    13. 13. More Demos
    14. 14. Have some fun</li></li></ul><li>Why Are You In This Talk?<br /><ul><li>Completely new to SharePoint administration
    15. 15. Been using STSADM and need to learn PowerShell
    16. 16. Been using PowerShell and want to use on SharePoint</li></ul>Little bit of content for everyone<br />
    17. 17. Quick Polls<br />Is your role admin / developer / other?<br />Have you used STSADM?<br />Have you used PowerShell?<br /><ul><li>If yes, level of proficiency (low, medium, high)?</li></ul>Already working with SharePoint 2010?<br />
    18. 18. Goals for this presentation…<br /><ul><li>Learn the following mantra</li></ul>“If you have to write/click twice then script/automate it”<br /><ul><li>Basics of PowerShell (independent of SharePoint)
    19. 19. Basic overview of SharePoint 2010 commandlets</li></li></ul><li>My Assistants for the Afternoon<br />
    20. 20. Breaking Open PowerShell<br />
    21. 21. PowerShell Origins<br /><ul><li>Introduced in 2006
    22. 22. Originally codename Monad
    23. 23. Later renamed to Microsoft Shell (MSH)
    24. 24. Later renamed again to Windows PowerShell
    25. 25. Becoming a cornerstone tool for administration</li></ul>Exchange 2007<br />SQL Server 2008<br />… and now SharePoint 2010!!<br />In 2010, your newest Swiss Army Knife in SP tool bag<br />
    26. 26. What Is PowerShell?<br />PowerShell is…<br /><ul><li>A command line shell
    27. 27. Object oriented</li></ul>Able to support .Net objects, not just text<br /><ul><li>Extensible
    28. 28. New scripting language</li></ul>Aims to be familiar to those writing VBscript or shell scripting like Unix, but simplified like command line<br />
    29. 29. Screenshot Comparison to CMD<br />
    30. 30. Brief Features Overview<br /><ul><li>Consistent syntax</li></ul>Shame on STSADM<br /><ul><li>Object oriented pipeline</li></ul>Able to pass object output from one cmdlet as input to next<br />Ex. Get-ChildItem | Sort-Object -Property LastWriteTime<br /><ul><li>Built-in providers</li></ul>Talk to Active Directory, registry, WMI, etc. natively<br /><ul><li>Aliases</li></ul>Bridge the gap for Unix, VBScript, etc. users<br /><ul><li>Tab complete
    31. 31. Many more…</li></li></ul><li>System Requirements<br />Default installed on Windows 7 and Server 2008 R2<br />Integrated Scripting Environment (ISE) optional role on Server 2008 R2<br />
    32. 32. How To Use<br />Syntax<br /><ul><li>Verb-Noun –parameter “Parameter value”</li></ul>Ex. Set-Location –Path C:/<br /><ul><li>Variables</li></ul>$variable_name = command<br /><ul><li>Case insensitive</li></ul>http://www.youtube.com/watch?v=KyLqUf4cdwc<br />
    33. 33. How To Use<br />Commandlets (or cmdlets)<br /><ul><li>Premade commands to handle basic functionality</li></ul>Ex. Get-Help; Invoke-Item; Write-Host<br /><ul><li>400+ with V2</li></ul>Modules and snap-ins allow adding custom commandlets<br />Scripts (.ps1)<br /><ul><li>Place commands into a script file for repeat use</li></li></ul><li>How To Find Help<br />Syntax<br /><ul><li>Get-Help [cmdlet [*]]
    34. 34. Get-Alias [cmdlet [*]]
    35. 35. (object) | Get-Member</li></ul>We’ll get to the pipe operator ‘|’ later<br /><ul><li>[] = optional
    36. 36. () = object or variable</li></li></ul><li>When to Use<br />Use PowerShell when…<br /><ul><li>a process must be consistent
    37. 37. a process must be performed for multiple workstations/users/etc
    38. 38. you don’t know the target that needs to be modified</li></ul>“If you have to write it twice, script it”<br />
    39. 39. Security Considerations<br /><ul><li>By default, PowerShell is locked down to not run scripts</li></ul>Need to unlock with Set-ExecutionPolicy <level><br />6 levels of execution available<br />Get-Help about_execution_policies<br /><ul><li>SharePoint requires permissions to run PowerShell</li></ul>Add-SPShellAdmin<br />http://technet.microsoft.com/en-us/library/ee748614(office.14).aspx<br />
    40. 40. A Word about the Profile<br />PowerShell Profile<br /><ul><li>Can pre-load aliases, shortcuts, variables, etc.
    41. 41. Good place to load needed assemblies
    42. 42. Accessed at $profile</li></ul><docs>WindowsPowerShellMicrosoft.PowerShell_profile<br /><docs>WindowsPowerShellMicrosoft.PowerShellise_profile<br />Easy to create: “new-item –type file –path <path>”<br />
    43. 43. Enough Intro, Let’s Demo<br />
    44. 44. Demo 1<br />Get-Help<br />Get-Member<br />Simple commands with file system<br />Get-Alias<br />Tab complete<br />
    45. 45. Power of the Pipe<br />
    46. 46. Power of the Pipe<br />The Pipe Operator “|”<br /><ul><li>Output from one command becomes input for the next
    47. 47. String together multiple commands</li></ul>Filtering Option<br /><ul><li>Sort-Object
    48. 48. Where-Object
    49. 49. Select-Object</li></li></ul><li>Demo 2<br />Piping commands to each other<br />Sort<br />Select<br />Where<br />
    50. 50. Our Protégé is Walking<br />
    51. 51. PowerShell Providers<br />Able to natively talk to:<br /><ul><li>File System
    52. 52. Environment
    53. 53. Registry
    54. 54. Alias
    55. 55. Function
    56. 56. Variable
    57. 57. Certificate</li></ul>Get-PSProvider & Get-PSDrive<br />
    58. 58. I know what you’re thinking…<br />28 Slides and no demos about SharePoint yet…?!?<br />
    59. 59. Accessing the SharePoint API<br />Microsoft.SharePoint.dll<br /><ul><li>SharePoint Object Model Hierarchy</li></ul>SPFarm<br />SPWebApplication<br />SPSite<br />SPWeb<br />SPList<br />SPListItem<br /><ul><li>Know how to handle SPSite and SPWeb memory</li></ul>Start-SPAssignment –global<br />Stop-SPAssignment<br />
    60. 60. Finally PowerShell + SharePoint<br />
    61. 61. Demo 3 – Site Hierarchy<br />Access SharePoint Hierarchy<br />Access object properties<br />http://sharepoint.microsoft.com/blogs/zach/Lists/Posts/Post.aspx?ID=43<br />
    62. 62. SharePoint Backup<br /><ul><li>Script out a backup/restore procedure (STSADM)
    63. 63. Remove old backups
    64. 64. Determine size of largest backup
    65. 65. Schedule PowerShell commands</li></ul>PowerShell -command "& 'MyScript.ps1' “<br />Place into a .cmd or .bat and schedule as usual<br />Can programmatically call script based on output from others<br />
    66. 66. SharePoint Backup<br /><ul><li>Script out a backup/restore procedure
    67. 67. Remove old backups
    68. 68. Determine size of largest backup</li></li></ul><li>Scheduling PowerShell Scripts<br /><ul><li>Schedule PowerShell commands</li></ul>PowerShell -command "& 'MyScript.ps1' “<br />Place into a .cmd or .bat and schedule as usual<br />Can programmatically call script based on output from others<br />
    69. 69. Demo 4 - Backups<br />Backup-SPSite<br />Backup-SPFarm<br />Get-SPBackupHistory<br />
    70. 70. SharePoint Site Administration<br />Ideas to think about:<br /><ul><li>Activate/deactivate features
    71. 71. Set/unset master pages
    72. 72. Create/delete site
    73. 73. Check file sizes on site
    74. 74. Update list values
    75. 75. …sky is the limit</li></li></ul><li>Demo 5 – Interacting Sites<br />Create site<br />Delete site<br />Recursively traverse site hierarchy<br />Enumerate site templates<br />
    76. 76. Limit Server Results With –Filter Switch<br />Typically you have this scenario<br />
    77. 77. Limit Server Results With –Filter Switch<br />Using –Filter limits results coming back from server<br />
    78. 78. Demo 6 – Server Side Filter<br />Filter SPWebs server side<br />
    79. 79. See How Fast This Shell Can Go<br />
    80. 80. Complex Scripts<br />Multitask within one script<br /><ul><li>Reference site
    81. 81. Recursively traverse site hierarchy
    82. 82. Read SharePoint group membership
    83. 83. Determine Active Directory groups
    84. 84. Expand Active Directory groups to users</li></li></ul><li>Demo 7 – Johnny 5 is Alive<br />The laser show spectacular<br />
    85. 85. Who’s Brain is Full Now?<br />
    86. 86. New Features in V2<br />PowerShell V2<br /><ul><li>PowerShell remoting
    87. 87. Integrated Scripting Environment (ISE)
    88. 88. Script debugging (breakpoints)
    89. 89. Background jobs
    90. 90. Modules
    91. 91. Get-Help –online</li></li></ul><li>V2 Release Schedule<br /><ul><li>Ships with Windows 7 and Server 2008 R2</li></ul>Automatically installed by default<br /><ul><li>Downloadable for XP/Server 2003 and above</li></ul>Released end of Oct 2009 as Windows Management Framework<br />
    92. 92. SharePoint 2010 Considerations<br />PowerShell preferred command line tool over STSADM<br /><ul><li>STSADM is being depricated</li></ul>Means STSADM is supported, but start learning PowerShell<br /><ul><li>Over 500 cmdlets to integrate with SharePoint
    93. 93. SharePoint Management Console = PowerShell
    94. 94. Remoting allows administrate entire farm centrally</li></li></ul><li>–Whatif and –Confirm clauses<br />Appending “-whatif” to commandlet allows seeing potential outcome without executing<br />Ex. Remove-SPWeb –urlhttp://site –whatif<br />Appending “-confirm” prompts user for confirmation before executing<br />Ex. Remove-SPWeb –urlhttp://site –confirm<br />
    95. 95. Conclusion<br /><ul><li>PowerShell is a new scripting admin tool
    96. 96. Syntax and how to use
    97. 97. Basic demos for file system and SharePoint
    98. 98. Hopefully had a few laughs as well</li></li></ul><li>References<br />PowerShell Product Homepage<br />http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx<br />PowerShell Script Center<br />http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx<br />PowerShell Owner’s Manual (good intro walkthroughs)<br />http://www.microsoft.com/technet/scriptcenter/topics/winpsh/manual/default.mspx<br />PowerShell Community<br />http://powershellcommunity.org<br />PowerShell and SharePoint 2010<br />http://stsadm.blogspot.com/2009/10/sharepoint-2010-stsadm-and-powershell.html<br />
    99. 99. Q&A<br />
    100. 100. Thank you for attending!<br />
    101. 101. 2 ASUS Netbooks<br />Also Some Books<br />1 Typemock Isolator License<br />A 2-5 Day Course from SetFocus on SharePoint<br />Telerik RAD Controls Set<br />1 DeliverPointWFE 2010 license (Worth $1500)<br />1 BCS Meta Man license (Worth $1200)<br />1 Lightning Conductor 2010 WFE license (Worth $800)<br />1 Lightning Storm Forums license. (Worth $600)<br />
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×