Intro to SharePoint + PowerShell
Upcoming SlideShare
Loading in...5
×
 

Intro to SharePoint + PowerShell

on

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

Statistics

Views

Total Views
653
Views on SlideShare
629
Embed Views
24

Actions

Likes
0
Downloads
11
Comments
0

1 Embed 24

http://192.168.33.10 24

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
  • Please add the sponsor LOGO (if it exists), name, short description and any urls if necessary to the designated areas. CITPG will add the sponsor level.
  • Start from a new PowerShell Window:Create a Site Collection:$site = New-SPSite –Url http://sps.adventureworks.com –Template “CMSPUBLISHING#0” –Name “SharePoint Saturday Cincinnati” –OwnerAlias isg1085\\spfarm –SecondaryOwnerAlias isg1085\\sharepointryan –Verbose$site | gm$web = $site.rootweb$web.title = “Modified”$web.update()Get-History | Out-File c:\\scripts\\demo.ps1
  • Start from a new PowerShell Window:Create a Site Collection:$site = New-SPSite –Url http://sps.adventureworks.com –Template “CMSPUBLISHING#0” –Name “SharePoint Saturday Cincinnati” –OwnerAlias isg1085\\spfarm –SecondaryOwnerAlias isg1085\\sharepointryan –Verbose$site | gm$web = $site.rootweb$web.title = “Modified”$web.update()Get-History | Out-File c:\\scripts\\demo.ps1
  • Create a script first, then talk about making it reusable by adding parameters and making it a functionCreate a dummy function on the shell to show how they work, then move into PowerGUIAdd some output with Write-HostAdd comment-based help

Intro to SharePoint + PowerShell Intro to SharePoint + PowerShell Presentation Transcript

  • Getting Started withSharePoint + PowerShell Ryan Dennis @SharePointRyan www.SharePointRyan.com
  • Learn PowerShell. 24/7, Anywhere. Enter POWERSAT at checkout to save $50 on any training course. www.TRAINSIGNAL.com
  • SeeShell Simple and Effective Data Visualization For PowerShell Use Coupon Code PSSAT002 And save 20%http://www.codeowls.com/seeshell
  • 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
  • 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
  • Verb-NounPowerShell uses a Verb-Noun syntax for itsCmdlets• Get-Something• Set-Something• New-Something• Remove-Something
  • 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
  • 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.
  • 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…
  • 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…
  • Creating a SharePoint Web Application using out-of-the-boxPowerShell Cmdlets DEMONSTRATION
  • 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
  • Creating a SharePoint Site Collection using out-of-the-boxPowerShell Cmdlets DEMONSTRATION TWO
  • 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)
  • 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…
  • Using what we already learned and making it better. DEMONSTRATION THREE
  • 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…
  • 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…
  • 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)…
  • 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