Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Intro to SharePoint + PowerShell

784 views

Published on

You may have heard of PowerShell, but do you know what it’s capable of? Gone are the days of long, painful STSADM batch files – we have Windows PowerShell, and it’s here to stay.Learn how you can use Windows PowerShell both to perform simple one-off tasks as well as complex, bulk operations. Leveraging the Object Model gives Administrators and Developers the ability to do in a few lines of code what would’ve taken a lot more work (and probably a Developer or two) in the WSS platform.You’ll see how you can get started with PowerShell, and you will hopefully leave with not only a greater understanding of what PowerShell is – but what it is capable of and how you can start using it to automate tasks in your SharePoint 2010 environment.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Intro to SharePoint + PowerShell

  1. 1. Getting Started withSharePoint + PowerShell Ryan Dennis @SharePointRyan www.SharePointRyan.com
  2. 2. Learn PowerShell. 24/7, Anywhere. Enter POWERSAT at checkout to save $50 on any training course. www.TRAINSIGNAL.com
  3. 3. SeeShell Simple and Effective Data Visualization For PowerShell Use Coupon Code PSSAT002 And save 20%http://www.codeowls.com/seeshell
  4. 4. About The SpeakerRyan Dennis, MCTS, MCPD, MCITPSenior SharePoint Engineer @ ICCMicrosoft Virtual Technology Specialist (vTSP) www.SharePointRyan.com @SharePointRyan linkedin.com/in/sharepointryan ryan@sharepointryan.com
  5. 5. Windows PowerShell…is a task-based command-line shell andscripting language designed especially forWindows system administration…has a task-based scripting language…includes powerful object manipulationcapabilities…is built on the .NET Framework
  6. 6. Verb-NounPowerShell uses a Verb-Noun syntax for itsCmdlets• Get-Something• Set-Something• New-Something• Remove-Something
  7. 7. Get-Command & Get-Help• While you can do a lot of the same things as the typical command prompt, use Get- Command to see available commands• Use Get-Help <cmdlet> to get help information for a cmdlet
  8. 8. Using PowerShell Profiles• PowerShell uses 2 profiles, a user specific profile and a machine-wide profile…• Use profiles to pre-load scripts, functions, environmental variables, shell settings, aliases, etc.
  9. 9. Script Editors & Tools• Notepad.exe (Lame)• Notepad++ (Less Lame)• Windows PowerShell ISE (Pretty Good - includes IntelliSense, Syntax highlighting)• Quest PowerGUI (Awesome – Adds advanced debugging, and other cool things – don’t worry, I’ll show you!)• Others…
  10. 10. SharePoint 2010 Cmdlets• 500+ Cmdlets…• MUCH better than STSADM.exe…• Can automate complete installations and configurations…• Still doesn’t answer every scenario, leaving gaps in functionality… – Example: Get, New and Remove SharePoint Groups – no cmdlet, easy to write a custom function though…
  11. 11. Creating a SharePoint Web Application using out-of-the-boxPowerShell Cmdlets DEMONSTRATION
  12. 12. Demo Recap• Used New-SPWebApplication to create a new SharePoint Web Application…• Stored the SPWebApplication object into the $webapp variable• Used Get-Member to view Methods and Properties associated with the Web Application
  13. 13. Creating a SharePoint Site Collection using out-of-the-boxPowerShell Cmdlets DEMONSTRATION TWO
  14. 14. Demo Recap• Used New-SPSite to create a new SharePoint Site Collection…• Stored the SPSite object into the $site variable• Created a $web variable from $site.rootweb• Used the $web variable to change the Site Title using the SP Object Model• Used Get-History and Pipeline to create a simple script from our command history…• Cool right, but what if we could make this reusable???  (Hint: we can)
  15. 15. Extending PowerShell with Scripts and Functions• PowerShell Scripts have .ps1 file extension…• Scripts and functions behave similarly if not identically, but functions are more reusable…• Scripts can reference functions and cmdlets…• Functions can include other functions within them and can also reference cmdlets…
  16. 16. Using what we already learned and making it better. DEMONSTRATION THREE
  17. 17. Demo Recap• Used the following cmdlets in conjunction with the pipeline to automagically build a function based on what we did in our first demonstration: – Get-History – Select-Object – Out-File• Used Quest PowerGUI to edit our function by adding Parameters, eliminating hard-coded values…• Added comment-based help from PowerGUI Snippet…• Tried out our cool, new function…
  18. 18. The Power IS in the Shell, Use it Wisely!• PowerShell is VERY powerful, be aware of memory issues...• Use dispose() method for Site and Web objects, or better yet…• Use Start-SPAssignment –Global to capture all objects in the Global store, then use Stop-SPAssignment –Global to dispose of all objects…
  19. 19. Get-Resources1. TechNet for general PowerShell information…2. The Hey, Scripting Guy! blog3. Get-SPScripts.com4. Gary Lapointe5. Get-Help in a PowerShell window…6. SharePointRyan.com (yes, my blog)…
  20. 20. Got-Questions -?Ryan Dennis, MCTS, MCPD, MCITPSenior SharePoint Engineer @ ICCMicrosoft Virtual Technology Specialist (vTSP) www.SharePointRyan.com @SharePointRyan linkedin.com/in/sharepointryan ryan@sharepointryan.com

×