1 / 59

PowerShell for SharePoint Developers and Administrators

PowerShell for SharePoint Developers and Administrators . Michael Blumenthal Magenic Technologies MichaelBl@Magenic.com. Who is Michael Blumenthal?. Sr. Consultant @ Magenic (MSFT Gold Partner) 16+ years in IT Consulting 9 years working with SharePoint

danae
Download Presentation

PowerShell for SharePoint Developers and Administrators

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PowerShell for SharePoint Developers and Administrators Michael Blumenthal Magenic Technologies MichaelBl@Magenic.com

  2. Who is Michael Blumenthal? • Sr. Consultant @ Magenic (MSFT Gold Partner) • 16+ years in IT Consulting • 9 years working with SharePoint • MCITP: SharePoint 2010; MCTS: WSS Dev • MCTS: MOSS Config & MCTS: WSS Config • MCAD, MCSE, MCDBA, CAPM, INETA Champ

  3. Why PowerShell?

  4. PowerShell puts the SharePoint Engine at your fingertips!

  5. Chapter 1 It’s Easy to get Started!

  6. Getting Started with PowerShell

  7. POSH vs the SP2010 Mgmt Shell

  8. Chapter 2 Learn the PowerShell Syntax!

  9. Learn to use PowerShell with SharePoint!

  10. Symbols, Keywords, and Syntax! Oh My!

  11. Punctuation Pronunciation Is “$#|” a “one dollar hash pipe”?

  12. 1 Variables begin with a $

  13. Commands are called cmdlets. • 2

  14. The Power of Piping! • 3 |

  15. Example

  16. Making Comparisons • 4

  17. Taking Control of the Flow • 5

  18. Example

  19. Where-Object • 6

  20. Using the SharePoint API

  21. Highlights from the SharePoint Object Model SPSite

  22. Loading SharePoint DLLs [void][System.Reflection.Assembly]:: LoadWithPartialName("Microsoft.SharePoint")

  23. Get a Site and Explore it! $site = get-spsite http://server/path THEN $site

  24. Create a List Item

  25. Practical Uses

  26. More Practical Uses

  27. A Word About Memory Management Dispose

  28. Executing Scripts

  29. Chapter 3 Real World Examples

  30. Real World Examples • Check the Farm Version • Check Versioning on all document Libraries • Create List Items • Export Web App Properties to a file • Bulk Site Creation

  31. What’s your SP2010 Version? PS C:\Users\Administrator> $(get-SPFarm).BuildVersion Major Minor Build Revision ----- ----- ----- -------- 14 0 6109 5002

  32. Check Doc Lib Versioning Settings function global:show-all-doclibs ($web) {$web.Lists | where-object {($_.Hidden -ne $true) -and ($_.BaseType -eq "DocumentLibrary")} } function global:show-all-doclib-versettings ($web) {show-all-doclibs ($web) |select-object -property Title, EnableVersioning, MajorVersionLimit, EnableMinorVersions,MajorWithMinorVersionsLimit,forceCheckout} $site = get-spsite “http://server/path” show-all-doclib-versettings $site.RootWeb

  33. Clear a List • Make a mess: • Clean it up!

  34. Bulk Site Creation Site Definitions in V. Studio PowerShell & Excel & UI Well suited for one time “blow in’s” Define the site template in the UI or use standard Save as a template Even pub sites PowerShell has easy loops Data driven from a CSV Changes -> Mod Scripts • Not an answer by themselves • Define site content • Intended for reuse • Mismatch to one time need • CAML and PITA • Harder: Making it data driven • Change Site Def -> Recreate Site

  35. The PowerShell Solution • Read the list of sites from CSV • Loop: • Create Site • Configure Site • Turn on Features • Set Master Pages, Welcome Page • Hide Libraries, set versioning • Adjust Navigation • Add Lists, Libraries, Pages, Web parts, etc • Loop again & again if needed – iterative!

  36. Chapter 4 More Resources

  37. Resources

  38. Use a Decompiler to see MSFT’s Code! OR ILSpy.net dotPeek (jetbrains) justDecompile (Telerik) Reflector(RedGate) Others… No Longer Free

More Related