1 / 63

PowerShell for SharePoint Developers and Administrators

PowerShell for SharePoint Developers and Administrators . Michael Blumenthal Magenic Technologies MichaelBl@Magenic.com. Who is Michael Blumenthal?. Associate Principal Consultant at Magenic 17 years in IT Consulting 9 years working with SharePoint (2003,2007,2010, 2013)

sahkyo
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? • Associate Principal Consultant at Magenic • 17 years in IT Consulting • 9 years working with SharePoint (2003,2007,2010, 2013) • 3x INETA Champ, CSPUG Co-Leader, SP Speaker

  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. V2

  9. PowerShell V3 ISE

  10. Chapter 2 Learn the PowerShell Syntax!

  11. Learn to use PowerShell with SharePoint!

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

  13. Punctuation Pronunciation 1$#|

  14. 1 Variables begin with a $

  15. Commands are called cmdlets. • 2

  16. The Power of Piping! • 3 |

  17. Example

  18. Making Comparisons • 4

  19. Taking Control of the Flow • 5

  20. Example

  21. Where-Object • 6

  22. Using the SharePoint API

  23. Highlights from the SharePoint Object Model SPSite

  24. Loading SharePoint 2010 Cmdlets C:\...\14\CONFIG\POWERSHELL\ Registration\SharePoint.ps1 [void][System.Reflection.Assembly]:: LoadWithPartialName("Microsoft.SharePoint") Loading SharePoint DLLs

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

  26. Create a List Item

  27. Practical Uses

  28. More Practical Uses

  29. A Word About Memory Management Dispose

  30. Executing Scripts

  31. Chapter 3 Real World Examples

  32. Real World Examples • Check the Farm Version • Check Versioning on all document Libraries • Create List Items • Bulk Site Creation • Post Deployment Build Scripts with Audio Alerts

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

  34. 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

  35. 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

  36. 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!

  37. Audio Alerts • Stick this at the end of your long running script: $Voice = new-object -com SAPI.SpVoice$Voice.Speak(“Deployment is done!")

  38. Chapter 3.1 Best Practices

  39. Best Practices

  40. Chapter 4 More Resources

  41. Resources

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

More Related