Your SlideShare is downloading. ×
0
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
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

SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience

926

Published on

http://www.sharepointcowbell.com

http://www.sharepointcowbell.com

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
926
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
7
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • http://powerguivsx.codeplex.com/
  • Transcript

    • 1. SharePoint PowerShell for the Admin & Developer A Venn Diagram Experience #DogFoodCon Ryan Dennis | Ricardo Wilkins
    • 2. What we’re barking about What is PowerShell? PowerShell and SharePoint – the evolution Scripts vs. code – comparison Business case walk through Code integration with PowerShell Architectural discussions #DogFoodCon
    • 3. Meet the Mutts Ryan Dennis Ricardo Wilkins Consultant, Blue Chip Consulting Group Consultant, Blue Chip Consulting Group #DogFoodCon
    • 4. What’s Your Breed? #DogFoodCon
    • 5. What is PowerShell? …is a task-based command-line shell and scripting language designed especially for Windows system administration …has a task-based scripting language …includes powerful object manipulation capabilities …is built on the .NET Framework #DogFoodCon
    • 6. PowerShell deals with Objects, not Strings • In order to find out what you can and cannot do or see on an object, use the Get-Member cmdlet • Get-Member will return all Methods and Properties associated with whatever item you pass to it • PowerShell uses a Verb-Noun syntax for its Cmdlets • Get-Something • Set-Something • New-Something #DogFoodCon
    • 7. The Pipeline • PowerShell passes objects, that is – when you do something like Get-Process, you’re retrieving process object(s) – you can then pipe that output, or that process object to Stop-Process, Select-Object, WhereObject, etc. • Use the built-in $_ variable to get values from the current object in the pipeline… • Let’s talk about this metaphorically…  #DogFoodCon
    • 8. The Pipeline #DogFoodCon
    • 9. 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… #DogFoodCon
    • 10. As a Developer, why do I care? • Not always necessary to write code • Use PowerShell to handle things you could do in C# • Don’t write console apps, write PowerShell Scripts! • Some clients don’t allow managed code deployments, but PowerShell is A-OK #DogFoodCon
    • 11. Managing Solutions & Features Farm Solutions • • • • • Add-SPSolution Get-SPSolution Install-SPSolution Remove-SPSolution RemoveSPSolutionDeployme ntLock • Uninstall-SPSolution • Update-SPSolution #DogFoodCon Sandboxed Solutions • Add-SPUserSolution • Get-SPUserSolution • InstallSPUserSolution • RemoveSPUserSolution • UninstallSPUserSolution • UpdateSPUserSolution Features • • • • • Disable-SPFeature Enable-SPFeature Get-SPFeature Install-SPFeature Uninstall-SPFeature
    • 12. Retrieving SharePoint Objects • Multiple ways to get a Site Object using PowerShell… • $Site = Get-SPSite • $Site = New-Object Microsoft.SharePoint.SPSite($Url) • Multiple ways to get a Web Object using PowerShell… • $Web = $Site.RootWeb • $Web = $Site.OpenWeb() • $Web = Get-SPWeb #DogFoodCon
    • 13. The Evolution of SP Scripting • About 200 cmds • Over 500 • Over 700 • No native support PowerShell cmdlets PowerShell cmdlets for PowerShell* • PowerShell Version • PowerShell Version • STSADM was it 2.0 3.0 #DogFoodCon *You could use PowerShell by loading the Microsoft.SharePoint Assembly…
    • 14. Pros & Cons of Script vs. Code Script Pros Quicker to write Easier to edit (open a file, edit it) No need to install a DLL to the server Can access the hundreds (thousands?) of other PowerShell cmdlets (Processes, Services, etc.) #DogFoodCon Code Cons Requires more time to develop& deploy Editing requires redeployment to server Requires a DLL installation
    • 15. C# vs. PowerShell // register controls protected TextBox TextBoxMinutesPerSession; protected LinkButton LinkButtonUpdate; // Create a click event handler LinkButtonUpdate.Click += new EventHandler(LinkButtonUpdate_Click); void LinkButtonUpdate_Click(object sender, EventArgs e) Both code snippets add or set the { // Grab the site and web Guid “CurrentUserSessionDuration” Guid sitedId = SPContext.Current.Site.ID; property in a Web. Guid webID = SPContext.Current.Web.ID; //create and dispose of spweb and spsite objects using (SPSite oSPSite = new SPSite(sitedId)) { using (SPWeb oWeb = oSPSite.OpenWeb(webID)) { //Set the custom web property to the textbox value oWeb.Properties["CurrentUserSessionDuration"] = TextBoxMinutesPerSession.Text; oWeb.Properties.Update(); } $web = Get-SPWeb http://url } $web.Properties["CurrentUserSessionDuration"] = "60" } $web.Properties.Update() $web.Dispose() #DogFoodCon
    • 16. The Business Case #DogFoodCon
    • 17. The Personas Developer #DogFoodCon Admin Business Analyst / Project Manager
    • 18. Get-Process –Name “Demo” | Start-Process #DogFoodCon
    • 19. Developer + PS IIS Server SharePoint Call PowerShell SPList Log ListItems #DogFoodCon Change Titles PS1
    • 20. SharePoint -Classic Web Part -Visual Web Part -SP2013 App Part #DogFoodCon
    • 21. Call PowerShell #DogFoodCon
    • 22. Call PowerShell #DogFoodCon http://ilovesharepoint.codeplex.com/wikipage?title=Execute%20PowerShell%20Script%20Action
    • 23. -Files reside in e.g. C:Scripts -Scripts calling scripts as functions -Storing scripts in source control (TFS) -BA/PM viewing scripts vs code #DogFoodCon
    • 24. SPList Log ListItems function Write-SPAppLogItem { [CmdletBinding()] Param( [Parameter(Mandatory=$true)][System.String]$WebUrl, [Parameter(Mandatory=$true)][System.String]$ListName ) $web = Get-SPWeb $WebUrl $list = $web.Lists[$ListName] $item = $list.Items.Add() $date = Get-Date $item["Title"] = "Operation completed successfully: $date" $item.Update() $web.Dispose() } #DogFoodCon
    • 25. SPList Log ListItems -BA/PM responsible for this list -Workflow can kickoff on New Item -Other apps, or Search, can pull from this list #DogFoodCon
    • 26. Why is this worth chewing on? Separation of Devs vs Ops Devs maintain the UI Ops maintains the Title Change process Separation of Concerns / Single Responsibility pattern #DogFoodCon
    • 27. Other things to chew on? PS in Office 365 PS in Azure PS Remoting PS Workflow #DogFoodCon
    • 28. Barks from the Pack Thoughts? Would this model work for you? Other ideas? #DogFoodCon
    • 29. >Get-Questions #DogFoodCon

    ×