Your SlideShare is downloading. ×
Spsatx slides (widescreen)
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Spsatx slides (widescreen)


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 …

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.

In this demo filled session, 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 or 2013 environment.

Published in: Technology

  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. The Power is in the Shell, use it wisely! Get-Command –Module Microsoft.SharePoint.PowerShell Ryan Dennis | MCTS, MCPD, MCITP SharePoint Solutions Architect, Focal Point Solutions
  • 2. THANK YOU FOR BEING A PART OF SHAREPOINTSATURDAY AUSTIN!• Please turn off all electronic devices or set them to vibrate• If you must take a phone call, please do so in the hall• Wi-Fi is available, you will need your Guest ID/password (at registration desk)• Feel free to tweet and blog during sessions. Remember to follow @SPSATX and tag #SPSATX in your tweets! SharePoint Saturday Austin is hosted by the Austin SharePoint User Group (@AustinSPUG) 2 | SharePoint Saturday Austin 2013
  • 4. THANKS TO OUR SPONSORS! 4 | SharePoint Saturday Austin 2013
  • 5. ABOUT THE SPEAKERRyan Dennis, MCTS, MCPD, MCITPSharePoint Solutions ArchitectFocal Point Solutions @SharePointRyan Father Husband Drummer Geek 5 | SharePoint Saturday Austin 2013
  • 6. WINDOWS POWERSHELL…is a task-based command-line shell and scripting language designedespecially for Windows system administration…has a task-based scripting language…includes powerful object manipulation capabilities…is built on the .NET Framework 6 | SharePoint Saturday Austin 2013
  • 7. VERB-NOUNPowerShell uses a Verb-Noun syntax for its Cmdlets• Get-Something• Set-Something Quick Tip!• New-Something Use Get-Verb to• Remove-Something find approved verbs! 7 | SharePoint Saturday Austin 2013
  • 8. 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 – Get-Command –Module Microsoft.SharePoint.PowerShell will show you all SharePoint Cmdlets• Use Get-Help <cmdlet> to get help information for a cmdlet – Get-Help <cmdlet> -Examples will show you examples for a cmdlet Quick Tip! Add Help to your scripts and functions! 8 | SharePoint Saturday Austin 2013
  • 9. USING POWERSHELL PROFILES• PowerShell uses 2 profiles, a user specific profile and a machine-wide profile…• Use profiles to pre-load snap-ins, scripts, functions, environmental variables, shell settings, aliases, etc. Quick Tip! Use New-Item $Profile –type file –force to create a profile! 9 | SharePoint Saturday Austin 2013
  • 10. SCRIPT EDITORS & TOOLS• Notepad.exe (Lame)• Notepad++ (Less Lame)• Windows PowerShell ISE (Pretty Good - includes IntelliSense, Syntax highlighting, MUCH better with PowerShell V3)• Quest PowerGUI (Awesome – Adds advanced debugging, and other cool things)• Visual Studio + PowerGUI Extensions (Probably best option, can integrate with Source Control, etc.)• Others… 10 | SharePoint Saturday Austin 2013
  • 11. SHAREPOINT CMDLETS• SharePoint 2010 – 500+ Cmdlets… – MUCH better than STSADM.exe… – Can automate complete installations and configurations…• SharePoint 2013 – 700+ Cmdlets!• 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 | SharePoint Saturday Austin 2013
  • 12. POWERSHELL WEB ACCESS & SHAREPOINT 2013• Pros: – Allows administrators to work with SP2013 without server access via a web browser – The default security is restrictive rather than permissive; zero authentication rules means no users have access to anything – All that is required to run PSWA is a properly-configured PowerShell Web Access gateway, and a client device browser that supports JavaScript and accepts cookies• Cons: – No profile means there is no good way to auto-load SharePoint Snap in or other scripts, functions or variables – Requires Windows Server 2012For more on PSWA, go here! (don’t worry, it’s TechNet) 12 | SharePoint Saturday Austin 2013
  • 13. SUPPORTED BROWSERS AND DEVICES Chrome Android Window Firefox s Phone iPad Safari Internet iPhone Explorer 13 | SharePoint Saturday Austin 2013
  • 14. SURPRISE!• We’re going to try something new today…• Let’s try to do a technical demo and presentation using ONLY a browser and a PowerShell editor! 14 | SharePoint Saturday Austin 2013
  • 15. DEMONSTRATIONManipulating a SharePoint Site Collection using out-of-the-box PowerShellCmdlets
  • 16. DEMO RECAP• Used Get-SPSite to get a SharePoint Site Collection…• Stored the SPSite object into the $site variable• Created a $web variable from $site.rootweb• Used Get-Member to view Methods and Properties associated with the Web• Viewed and changed properties on the $web object using PowerShell• Used the $web variable to change the Site Title using the SP Object Model• Had some fun! 16 | SharePoint Saturday Austin 2013
  • 17. DEMONSTRATION TWOCreating a new PowerShell Function for reusability
  • 18. DEMO RECAP• Used the previous demo example to create a basic function using PowerShell ISE V3• Added and demonstrated Comment-based help and parameters• Tried it out• Had more fun! 18 | SharePoint Saturday Austin 2013
  • 19. EXTENDING POWERSHELL WITH SCRIPTS ANDFUNCTIONS• 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… 19 | SharePoint Saturday Austin 2013
  • 20. NOW, FOR THE GRAND FINALE…• You’ve seen some cool cmdlets, we’ve piped, we’ve used Get- History, Select-Object, etc…• There are a few cmdlets that can make bulk tasks VERY easy and fun… – Get-Content – ForEach-Object• Using these in conjunction with other SharePoint cmdlets or custom functions can make your PowerShell life much more awesome 20 | SharePoint Saturday Austin 2013
  • 21. WHAT WERE THOSE AGAIN?• Get-Content – Can read the contents of a file… – Can store the contents in a variable… – Can process XML files… – Can be piped into other cmdlets…• ForEach-Object – Provides a way to loop through - and perform an action on - each item in a collection.… 21 | SharePoint Saturday Austin 2013
  • 22. SPSSITES.XML SYNTAX<?xml version="1.0" encoding="utf-8"?><Sites> <SiteAdmins> <User>adventureworksrdennis</User> <User>adventureworksspfarm</User> </SiteAdmins><!-- root site --><Site Create=“true"> <SiteTitle>Home</SiteTitle> <SiteUrl>/</SiteUrl> <Page IsHomePage="true"> <PageTitle>Home</PageTitle> <PageUrl>Home.aspx</PageUrl> <PageLayout>Blank Web Part Page</PageLayout> </Page> 22 | SharePoint Saturday Austin 2013</Site>
  • 23. DEMONSTRATION THREEAutomating the provisioning of bulk sites and pages using XML input
  • 24. DEMO RECAP• Used the following cmdlets in an Advanced Function to automate the provisioning of 5 SharePoint Sites, each with several Publishing Pages, all from XML input: – Get-Content – ForEach-Object – New-SPWeb – Write-Progress• Used Windows PowerShell ISE V3 to edit our function by adding Parameters, eliminating hard-coded values…• Tried out our cool, new function…• Checked out the sites and pages 24 | SharePoint Saturday Austin 2013
  • 25. 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… 25 | SharePoint Saturday Austin 2013
  • 26. 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. Twitter using #PowerShell7. (yes, my blog)… 26 | SharePoint Saturday Austin 2013
  • 27. GOT-QUESTIONS | START-ASKINGRyan Dennis, MCTS, MCPD, MCITPSharePoint Solutions ArchitectFocal Point Solutions @SharePointRyan 27 | SharePoint Saturday Austin 2013