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

Spsatx slides (widescreen)

on

  • 2,105 views

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

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.

Statistics

Views

Total Views
2,105
Views on SlideShare
456
Embed Views
1,649

Actions

Likes
0
Downloads
6
Comments
0

5 Embeds 1,649

http://sharepointryan.com 1512
http://www.focalpointsolutions.co 106
http://sharepointryandotcom.wordpress.com 18
http://lanyrd.com 7
http://abtasty.com 6

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Spsatx slides (widescreen) Spsatx slides (widescreen) Presentation Transcript

  • 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
  • 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
  • PLEASE FILL OUT SESSION EVALUATIONS AND THANK YOU FOR ATTENDING!
  • THANKS TO OUR SPONSORS! 4 | SharePoint Saturday Austin 2013
  • ABOUT THE SPEAKERRyan Dennis, MCTS, MCPD, MCITPSharePoint Solutions ArchitectFocal Point Solutions www.focalpointsolutions.co www.sharepointryan.com @SharePointRyan Father Husband linkedin.com/in/sharepointryan ryan@sharepointryan.com Drummer Geek 5 | SharePoint Saturday Austin 2013
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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) http://bit.ly/x18ztj 12 | SharePoint Saturday Austin 2013
  • SUPPORTED BROWSERS AND DEVICES Chrome Android Window Firefox s Phone iPad Safari Internet iPhone Explorer 13 | SharePoint Saturday Austin 2013
  • 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
  • DEMONSTRATIONManipulating a SharePoint Site Collection using out-of-the-box PowerShellCmdlets
  • 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
  • DEMONSTRATION TWOCreating a new PowerShell Function for reusability
  • 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
  • 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
  • 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
  • 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
  • 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>
  • DEMONSTRATION THREEAutomating the provisioning of bulk sites and pages using XML input
  • 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
  • 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
  • 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. SharePointRyan.com (yes, my blog)… 26 | SharePoint Saturday Austin 2013
  • GOT-QUESTIONS | START-ASKINGRyan Dennis, MCTS, MCPD, MCITPSharePoint Solutions ArchitectFocal Point Solutions www.focalpointsolutions.co www.sharepointryan.com @SharePointRyan linkedin.com/in/sharepointryan ryan@sharepointryan.com 27 | SharePoint Saturday Austin 2013