SlideShare a Scribd company logo
1 of 19
PowerShell and SharePoint
       Talbott Crowell
           April 28, 2012
SharePoint Saturday Boston #SPSBOS

      http://www.thirdm.com
             @talbott
What is PowerShell?
•   Unix-like shell
•   Object oriented
•   .NET
•   Command line
•   Scripting language



                         www.sharepointsaturday.org/boston::WEB
                                        http://www.thirdm.com WEB
                           http://talbottcrowell.wordpress.com::EMAIL
                                      SPSBoston@live.com BLOG
                                                   @talbott : TWITTER
                                 @SPSBoston / #SPSBos : TWITTER
Why PowerShell for SharePoint?
•   Automated build and deploy
•   Rapid prototyping
•   Exploring “What If” scenarios
•   Developer onboarding
•   Administration automation



                                    www.sharepointsaturday.org/boston::WEB
                                                   http://www.thirdm.com WEB
                                      http://talbottcrowell.wordpress.com::EMAIL
                                                 SPSBoston@live.com BLOG
                                                              @talbott : TWITTER
                                            @SPSBoston / #SPSBos : TWITTER
When use PowerShell?
• When you want to make your team more agile
  – Automation, automation, automation
• When developing, your daily build is like the
  projects heartbeat
  – PowerShell can be the pacemaker
• Testing
  – Use the PowerShell scripts to stand up an
    environment for running tests

                                  www.sharepointsaturday.org/boston::WEB
                                                 http://www.thirdm.com WEB
                                    http://talbottcrowell.wordpress.com::EMAIL
                                               SPSBoston@live.com BLOG
                                                            @talbott : TWITTER
                                          @SPSBoston / #SPSBos : TWITTER
PowerShell Basics
• What do you know about a command line?
  – DIR
• How about
  – $a = DIR
• What is $a?
  – .NET Object
     • use gm or get-member to query properites
  – Array
     • $a[0]

                                        www.sharepointsaturday.org/boston::WEB
                                                       http://www.thirdm.com WEB
                                          http://talbottcrowell.wordpress.com::EMAIL
                                                     SPSBoston@live.com BLOG
                                                                  @talbott : TWITTER
                                                @SPSBoston / #SPSBos : TWITTER
Demo - Basics
• PowerShell Basics
  – $a = DIR
  – $a | gm
  – Dates




                      www.sharepointsaturday.org/boston::WEB
                                     http://www.thirdm.com WEB
                        http://talbottcrowell.wordpress.com::EMAIL
                                   SPSBoston@live.com BLOG
                                                @talbott : TWITTER
                              @SPSBoston / #SPSBos : TWITTER
Tools
• cmd, notepad
• PowerShell Command
• Windows PowerShell Integrated Scripting
  Environment (ISE)
  – Import-Module ServerManager;
  – Add-WindowsFeature PowerShell-ISE
• PowerGUI
  – Download from powergui.org
                                 www.sharepointsaturday.org/boston::WEB
                                                http://www.thirdm.com WEB
                                   http://talbottcrowell.wordpress.com::EMAIL
                                              SPSBoston@live.com BLOG
                                                           @talbott : TWITTER
                                         @SPSBoston / #SPSBos : TWITTER
More Basics
•   # for comment
•   Verb-Noun convention for commandlets
•   Write-Host “Hello World”
•   Set-ExecutionPolicy Unrestricted
•   .scriptname to execute



                              www.sharepointsaturday.org/boston::WEB
                                             http://www.thirdm.com WEB
                                http://talbottcrowell.wordpress.com::EMAIL
                                           SPSBoston@live.com BLOG
                                                        @talbott : TWITTER
                                      @SPSBoston / #SPSBos : TWITTER
SharePoint 2010
• Comes with PowerShell Commandlets
  – Get-SPSite
  – New-SPSite
  – New-SPWeb
• If you are running from standard PowerShell
  Add-PSSnapin microsoft.sharepoint.powershell
  -ErrorAction SilentlyContinue

                                www.sharepointsaturday.org/boston::WEB
                                               http://www.thirdm.com WEB
                                  http://talbottcrowell.wordpress.com::EMAIL
                                             SPSBoston@live.com BLOG
                                                          @talbott : TWITTER
                                        @SPSBoston / #SPSBos : TWITTER
Create Site Collections and Sites
• Get-SPSite
  – Parameter: url
• New-SPSite
  – Parameters: url, name, ownerAlias, template
• New-SPWeb
  – Parameters: url, name, description, template…
  – Other params:
     • -AddToTopNav or -UseParentTopNav
     • -AddToQuickLaunch

                                      www.sharepointsaturday.org/boston::WEB
                                                     http://www.thirdm.com WEB
                                        http://talbottcrowell.wordpress.com::EMAIL
                                                   SPSBoston@live.com BLOG
                                                                @talbott : TWITTER
                                              @SPSBoston / #SPSBos : TWITTER
What about MOSS 2007 or WSS?
• Your friend STSADM is still there
• You can call STSADM or any command line tool from
  PowerShell
• You can write your own command line tools with .NET
• Better yet, you can write your own PowerShell
  Commandlets!
   – Inherit from Cmdlet or PSCmdlet
• Gary Lapointe has WSS and MOSS Cmdlets!
   – http://stsadm.blogspot.com/2009/02/downloads.html

                                       www.sharepointsaturday.org/boston::WEB
                                                      http://www.thirdm.com WEB
                                         http://talbottcrowell.wordpress.com::EMAIL
                                                    SPSBoston@live.com BLOG
                                                                 @talbott : TWITTER
                                               @SPSBoston / #SPSBos : TWITTER
Creating SharePoint 2010 Cmdlets
• When creating non-persistent tasks (i.e. get info) use:
   – SPCmdlet
• When objects persist between commands, use:
   –   SPRemoveCmdletBase
   –   SPNewCmdletBase
   –   SPSetCmdletBase
   –   SPGetCmdletBase
• For more info, see Gary Lapointe’s blog post:
   – http://stsadm.blogspot.com/2009/10/creating-custom-
     sharepoint-2010-cmdlets.html
                                      www.sharepointsaturday.org/boston::WEB
                                                     http://www.thirdm.com WEB
                                        http://talbottcrowell.wordpress.com::EMAIL
                                                   SPSBoston@live.com BLOG
                                                                @talbott : TWITTER
                                              @SPSBoston / #SPSBos : TWITTER
Creating SharePoint Objects
• [void][System.Reflection.Assembly]::LoadWithPar
  tialName(”Microsoft.SharePoint”)
  – Load the assembly
• $SPSite = New-Object
  Microsoft.SharePoint.SPSite($url)
  – Reference to the site collection using SharePoint
    object model
• Don’t forget to
  – $SPSite.Dispose()
                                      www.sharepointsaturday.org/boston::WEB
                                                     http://www.thirdm.com WEB
                                        http://talbottcrowell.wordpress.com::EMAIL
                                                   SPSBoston@live.com BLOG
                                                                @talbott : TWITTER
                                              @SPSBoston / #SPSBos : TWITTER
Strategy
• Series of scripts to build your site
• Cleanup script to destroy site
• Edit script, run cleanup, run script, view site
  – Repeat




                                 www.sharepointsaturday.org/boston::WEB
                                                http://www.thirdm.com WEB
                                   http://talbottcrowell.wordpress.com::EMAIL
                                              SPSBoston@live.com BLOG
                                                           @talbott : TWITTER
                                         @SPSBoston / #SPSBos : TWITTER
Demo – series of scripts
• Build2010.ps1
   – Calls other scripts
• Build2010_site_structure.ps1
   – Sets up the basic site structure and content types
• Build2010_upload_file.ps1
   – Uploads sample files to the site
• Build2010_set_logo.ps1
   – Adds site logo
• Build2010_add_users.ps1
   – Adds users to local machine and/or SharePoint groups

                                          www.sharepointsaturday.org/boston::WEB
                                                         http://www.thirdm.com WEB
                                            http://talbottcrowell.wordpress.com::EMAIL
                                                       SPSBoston@live.com BLOG
                                                                    @talbott : TWITTER
                                                  @SPSBoston / #SPSBos : TWITTER
Defining functions
• function Get-Theme
  ([Microsoft.SharePoint.SPWeb]$SPWeb,
   [string]$themeName)
• Strong typed parameters
• Returns
  Microsoft.SharePoint.Utilities.ThmxTheme


                              www.sharepointsaturday.org/boston::WEB
                                             http://www.thirdm.com WEB
                                http://talbottcrowell.wordpress.com::EMAIL
                                           SPSBoston@live.com BLOG
                                                        @talbott : TWITTER
                                      @SPSBoston / #SPSBos : TWITTER
Iteration Style Scripts
• Upload File
   – Takes in 1 or more files
• Has 3 blocks
   – Begin
   – Process
   – End
• Process is executed for each file
• gci 'C:uploadfilesSamplesLegal' |
  .build2010_upload_file.ps1 -Location "shared/legal" -
  DocLib "Documents" -ContentType "Document" -
  MetaDataField "Dept" -MetaDataValue "Legal"
                                     www.sharepointsaturday.org/boston::WEB
                                                    http://www.thirdm.com WEB
                                       http://talbottcrowell.wordpress.com::EMAIL
                                                  SPSBoston@live.com BLOG
                                                               @talbott : TWITTER
                                             @SPSBoston / #SPSBos : TWITTER
Other References
• How to: Build a SharePoint 2010 PowerShell Cmdlet
   – http://silverlight.sys-con.com/node/1370916




                                              www.sharepointsaturday.org/boston::WEB
                                                             http://www.thirdm.com WEB
                                                http://talbottcrowell.wordpress.com::EMAIL
                                                           SPSBoston@live.com BLOG
                                                                        @talbott : TWITTER
                                                      @SPSBoston / #SPSBos : TWITTER
Thank you. Questions?
  PowerShell and SharePoint



         Talbott Crowell
            ThirdM.com
http://talbottcrowell.wordpress.com/
         Twitter: @talbott

More Related Content

What's hot

Isomorphic WordPress Applications with NodeifyWP
Isomorphic WordPress Applications with NodeifyWPIsomorphic WordPress Applications with NodeifyWP
Isomorphic WordPress Applications with NodeifyWPTaylor Lovett
 
JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPressTaylor Lovett
 
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram ExperienceSharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram ExperienceRicardo Wilkins
 
Unlocking the Magical Powers of WP_Query
Unlocking the Magical Powers of WP_QueryUnlocking the Magical Powers of WP_Query
Unlocking the Magical Powers of WP_QueryDustin Filippini
 
Best Practices for WordPress
Best Practices for WordPressBest Practices for WordPress
Best Practices for WordPressTaylor Lovett
 
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)Cliff Seal
 
Best Practices for Building WordPress Applications
Best Practices for Building WordPress ApplicationsBest Practices for Building WordPress Applications
Best Practices for Building WordPress ApplicationsTaylor Lovett
 
Intro to SharePoint + PowerShell
Intro to SharePoint + PowerShellIntro to SharePoint + PowerShell
Intro to SharePoint + PowerShellRyan Dennis
 
40+ tips to use Postman more efficiently
40+ tips to use Postman more efficiently40+ tips to use Postman more efficiently
40+ tips to use Postman more efficientlypostmanclient
 
Stress Free Deployment - Confoo 2011
Stress Free Deployment  - Confoo 2011Stress Free Deployment  - Confoo 2011
Stress Free Deployment - Confoo 2011Bachkoutou Toutou
 
Here Be Dragons - Debugging WordPress
Here Be Dragons - Debugging WordPressHere Be Dragons - Debugging WordPress
Here Be Dragons - Debugging WordPressRami Sayar
 
Varying wordpressdevelopmentenvironment wp-campus2016
Varying wordpressdevelopmentenvironment wp-campus2016Varying wordpressdevelopmentenvironment wp-campus2016
Varying wordpressdevelopmentenvironment wp-campus2016David Brattoli
 
Multi tenant CMSes using php
Multi tenant CMSes using phpMulti tenant CMSes using php
Multi tenant CMSes using phpkae-verens
 
YAPC::EU 2015 - Perl Conferences
YAPC::EU 2015 - Perl ConferencesYAPC::EU 2015 - Perl Conferences
YAPC::EU 2015 - Perl Conferencesℕicolas ℝ.
 
Introduction to Laravel
Introduction to LaravelIntroduction to Laravel
Introduction to LaravelVin Lim
 
How Ansible Makes Automation Easy
How Ansible Makes Automation EasyHow Ansible Makes Automation Easy
How Ansible Makes Automation EasyPeter Sankauskas
 
High Performance Drupal
High Performance DrupalHigh Performance Drupal
High Performance DrupalJeff Geerling
 
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra  SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra Sencha
 
Selenium Tips & Tricks - StarWest 2015
Selenium Tips & Tricks - StarWest 2015Selenium Tips & Tricks - StarWest 2015
Selenium Tips & Tricks - StarWest 2015Andrew Krug
 

What's hot (20)

Isomorphic WordPress Applications with NodeifyWP
Isomorphic WordPress Applications with NodeifyWPIsomorphic WordPress Applications with NodeifyWP
Isomorphic WordPress Applications with NodeifyWP
 
JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPress
 
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram ExperienceSharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
 
Unlocking the Magical Powers of WP_Query
Unlocking the Magical Powers of WP_QueryUnlocking the Magical Powers of WP_Query
Unlocking the Magical Powers of WP_Query
 
Fluxible
FluxibleFluxible
Fluxible
 
Best Practices for WordPress
Best Practices for WordPressBest Practices for WordPress
Best Practices for WordPress
 
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
 
Best Practices for Building WordPress Applications
Best Practices for Building WordPress ApplicationsBest Practices for Building WordPress Applications
Best Practices for Building WordPress Applications
 
Intro to SharePoint + PowerShell
Intro to SharePoint + PowerShellIntro to SharePoint + PowerShell
Intro to SharePoint + PowerShell
 
40+ tips to use Postman more efficiently
40+ tips to use Postman more efficiently40+ tips to use Postman more efficiently
40+ tips to use Postman more efficiently
 
Stress Free Deployment - Confoo 2011
Stress Free Deployment  - Confoo 2011Stress Free Deployment  - Confoo 2011
Stress Free Deployment - Confoo 2011
 
Here Be Dragons - Debugging WordPress
Here Be Dragons - Debugging WordPressHere Be Dragons - Debugging WordPress
Here Be Dragons - Debugging WordPress
 
Varying wordpressdevelopmentenvironment wp-campus2016
Varying wordpressdevelopmentenvironment wp-campus2016Varying wordpressdevelopmentenvironment wp-campus2016
Varying wordpressdevelopmentenvironment wp-campus2016
 
Multi tenant CMSes using php
Multi tenant CMSes using phpMulti tenant CMSes using php
Multi tenant CMSes using php
 
YAPC::EU 2015 - Perl Conferences
YAPC::EU 2015 - Perl ConferencesYAPC::EU 2015 - Perl Conferences
YAPC::EU 2015 - Perl Conferences
 
Introduction to Laravel
Introduction to LaravelIntroduction to Laravel
Introduction to Laravel
 
How Ansible Makes Automation Easy
How Ansible Makes Automation EasyHow Ansible Makes Automation Easy
How Ansible Makes Automation Easy
 
High Performance Drupal
High Performance DrupalHigh Performance Drupal
High Performance Drupal
 
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra  SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
 
Selenium Tips & Tricks - StarWest 2015
Selenium Tips & Tricks - StarWest 2015Selenium Tips & Tricks - StarWest 2015
Selenium Tips & Tricks - StarWest 2015
 

Similar to PowerShell and SharePoint

PowerShell and SharePoint @spsnyc July 2012
PowerShell and SharePoint @spsnyc July 2012PowerShell and SharePoint @spsnyc July 2012
PowerShell and SharePoint @spsnyc July 2012Talbott Crowell
 
Introduction to PowerShell for SharePoint Admins and Developers
Introduction to PowerShell for SharePoint Admins and DevelopersIntroduction to PowerShell for SharePoint Admins and Developers
Introduction to PowerShell for SharePoint Admins and DevelopersMichael Blumenthal (Microsoft MVP)
 
Power to the People: Manipulating SharePoint with Client-Side JavaScript
Power to the People:  Manipulating SharePoint with Client-Side JavaScriptPower to the People:  Manipulating SharePoint with Client-Side JavaScript
Power to the People: Manipulating SharePoint with Client-Side JavaScriptPeterBrunone
 
Automating everything with Microsoft Flow
Automating everything with Microsoft FlowAutomating everything with Microsoft Flow
Automating everything with Microsoft FlowJaap Brasser
 
Drew madelung sp designer workflows - sp-biz
Drew madelung   sp designer workflows - sp-bizDrew madelung   sp designer workflows - sp-biz
Drew madelung sp designer workflows - sp-bizDrew Madelung
 
Building End User Productivity into your SharePoint Planning #BASPUG
Building End User Productivity into your SharePoint Planning #BASPUGBuilding End User Productivity into your SharePoint Planning #BASPUG
Building End User Productivity into your SharePoint Planning #BASPUGChristian Buckley
 
SharePoint 2010 Application Lifecycle Management
SharePoint 2010 Application Lifecycle ManagementSharePoint 2010 Application Lifecycle Management
SharePoint 2010 Application Lifecycle ManagementIvan Sanders
 
2015 nouveaux outilsdevweb
2015 nouveaux outilsdevweb2015 nouveaux outilsdevweb
2015 nouveaux outilsdevwebPhilippe Antoine
 
Share point development 101
Share point development 101Share point development 101
Share point development 101Becky Bertram
 
TDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecer
TDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecerTDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecer
TDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecerStefan Teixeira
 
Frontend tooling and workflows
Frontend tooling and workflowsFrontend tooling and workflows
Frontend tooling and workflowsDmitry Semigradsky
 
Identifying and solving enterprise problems
Identifying and solving enterprise problems  Identifying and solving enterprise problems
Identifying and solving enterprise problems Vasu Jain
 
Social Media Data
Social Media DataSocial Media Data
Social Media DataWill Simm
 
Tech Ed Africa Share Point Infra Fundamentals
Tech Ed Africa Share Point Infra FundamentalsTech Ed Africa Share Point Infra Fundamentals
Tech Ed Africa Share Point Infra FundamentalsJoel Oleson
 
SQL Server PowerShell - Community Tools
SQL Server PowerShell - Community ToolsSQL Server PowerShell - Community Tools
SQL Server PowerShell - Community ToolsLars Platzdasch
 
Quick & Easy SharePoint Forms with StratusForms
Quick & Easy SharePoint Forms with StratusFormsQuick & Easy SharePoint Forms with StratusForms
Quick & Easy SharePoint Forms with StratusFormsApril Dunnam
 
BotCommons: Metadata for Bots - Devoxx 2017
BotCommons: Metadata for Bots - Devoxx 2017BotCommons: Metadata for Bots - Devoxx 2017
BotCommons: Metadata for Bots - Devoxx 2017Cisco DevNet
 
WordPress SEO on Drugs!
WordPress SEO on Drugs!WordPress SEO on Drugs!
WordPress SEO on Drugs!Simon Sundén
 

Similar to PowerShell and SharePoint (20)

PowerShell and SharePoint @spsnyc July 2012
PowerShell and SharePoint @spsnyc July 2012PowerShell and SharePoint @spsnyc July 2012
PowerShell and SharePoint @spsnyc July 2012
 
Building a Reddit Clone from the Ground Up
Building a Reddit Clone from the Ground UpBuilding a Reddit Clone from the Ground Up
Building a Reddit Clone from the Ground Up
 
Introduction to PowerShell for SharePoint Admins and Developers
Introduction to PowerShell for SharePoint Admins and DevelopersIntroduction to PowerShell for SharePoint Admins and Developers
Introduction to PowerShell for SharePoint Admins and Developers
 
Power to the People: Manipulating SharePoint with Client-Side JavaScript
Power to the People:  Manipulating SharePoint with Client-Side JavaScriptPower to the People:  Manipulating SharePoint with Client-Side JavaScript
Power to the People: Manipulating SharePoint with Client-Side JavaScript
 
Automating everything with Microsoft Flow
Automating everything with Microsoft FlowAutomating everything with Microsoft Flow
Automating everything with Microsoft Flow
 
Drew madelung sp designer workflows - sp-biz
Drew madelung   sp designer workflows - sp-bizDrew madelung   sp designer workflows - sp-biz
Drew madelung sp designer workflows - sp-biz
 
Building End User Productivity into your SharePoint Planning #BASPUG
Building End User Productivity into your SharePoint Planning #BASPUGBuilding End User Productivity into your SharePoint Planning #BASPUG
Building End User Productivity into your SharePoint Planning #BASPUG
 
SharePoint 2010 Application Lifecycle Management
SharePoint 2010 Application Lifecycle ManagementSharePoint 2010 Application Lifecycle Management
SharePoint 2010 Application Lifecycle Management
 
2015 nouveaux outilsdevweb
2015 nouveaux outilsdevweb2015 nouveaux outilsdevweb
2015 nouveaux outilsdevweb
 
Share point development 101
Share point development 101Share point development 101
Share point development 101
 
Chatbots
ChatbotsChatbots
Chatbots
 
TDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecer
TDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecerTDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecer
TDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecer
 
Frontend tooling and workflows
Frontend tooling and workflowsFrontend tooling and workflows
Frontend tooling and workflows
 
Identifying and solving enterprise problems
Identifying and solving enterprise problems  Identifying and solving enterprise problems
Identifying and solving enterprise problems
 
Social Media Data
Social Media DataSocial Media Data
Social Media Data
 
Tech Ed Africa Share Point Infra Fundamentals
Tech Ed Africa Share Point Infra FundamentalsTech Ed Africa Share Point Infra Fundamentals
Tech Ed Africa Share Point Infra Fundamentals
 
SQL Server PowerShell - Community Tools
SQL Server PowerShell - Community ToolsSQL Server PowerShell - Community Tools
SQL Server PowerShell - Community Tools
 
Quick & Easy SharePoint Forms with StratusForms
Quick & Easy SharePoint Forms with StratusFormsQuick & Easy SharePoint Forms with StratusForms
Quick & Easy SharePoint Forms with StratusForms
 
BotCommons: Metadata for Bots - Devoxx 2017
BotCommons: Metadata for Bots - Devoxx 2017BotCommons: Metadata for Bots - Devoxx 2017
BotCommons: Metadata for Bots - Devoxx 2017
 
WordPress SEO on Drugs!
WordPress SEO on Drugs!WordPress SEO on Drugs!
WordPress SEO on Drugs!
 

More from Talbott Crowell

Top 3 Mistakes when Building
Top 3 Mistakes when BuildingTop 3 Mistakes when Building
Top 3 Mistakes when BuildingTalbott Crowell
 
Building high performance and scalable share point applications
Building high performance and scalable share point applicationsBuilding high performance and scalable share point applications
Building high performance and scalable share point applicationsTalbott Crowell
 
Road to the Cloud - Extending your reach with SharePoint and Office 365
Road to the Cloud - Extending your reach with SharePoint and Office 365Road to the Cloud - Extending your reach with SharePoint and Office 365
Road to the Cloud - Extending your reach with SharePoint and Office 365Talbott Crowell
 
Custom Development for SharePoint
Custom Development for SharePointCustom Development for SharePoint
Custom Development for SharePointTalbott Crowell
 
Custom Development in SharePoint – What are my options now?
Custom Development in SharePoint – What are my options now?Custom Development in SharePoint – What are my options now?
Custom Development in SharePoint – What are my options now?Talbott Crowell
 
Developing a Provider Hosted SharePoint app
Developing a Provider Hosted SharePoint appDeveloping a Provider Hosted SharePoint app
Developing a Provider Hosted SharePoint appTalbott Crowell
 
Developing a provider hosted share point app
Developing a provider hosted share point appDeveloping a provider hosted share point app
Developing a provider hosted share point appTalbott Crowell
 
Exploring SharePoint with F#
Exploring SharePoint with F#Exploring SharePoint with F#
Exploring SharePoint with F#Talbott Crowell
 
Automating PowerShell with SharePoint
Automating PowerShell with SharePointAutomating PowerShell with SharePoint
Automating PowerShell with SharePointTalbott Crowell
 
SharePoint Saturday Boston 2010
SharePoint Saturday Boston 2010SharePoint Saturday Boston 2010
SharePoint Saturday Boston 2010Talbott Crowell
 
Automating SQL Server Database Creation for SharePoint
Automating SQL Server Database Creation for SharePointAutomating SQL Server Database Creation for SharePoint
Automating SQL Server Database Creation for SharePointTalbott Crowell
 
Architecting Solutions for the Manycore Future
Architecting Solutions for the Manycore FutureArchitecting Solutions for the Manycore Future
Architecting Solutions for the Manycore FutureTalbott Crowell
 

More from Talbott Crowell (17)

Top 7 mistakes
Top 7 mistakesTop 7 mistakes
Top 7 mistakes
 
Top 3 Mistakes when Building
Top 3 Mistakes when BuildingTop 3 Mistakes when Building
Top 3 Mistakes when Building
 
Building high performance and scalable share point applications
Building high performance and scalable share point applicationsBuilding high performance and scalable share point applications
Building high performance and scalable share point applications
 
Road to the Cloud - Extending your reach with SharePoint and Office 365
Road to the Cloud - Extending your reach with SharePoint and Office 365Road to the Cloud - Extending your reach with SharePoint and Office 365
Road to the Cloud - Extending your reach with SharePoint and Office 365
 
Custom Development for SharePoint
Custom Development for SharePointCustom Development for SharePoint
Custom Development for SharePoint
 
Custom Development in SharePoint – What are my options now?
Custom Development in SharePoint – What are my options now?Custom Development in SharePoint – What are my options now?
Custom Development in SharePoint – What are my options now?
 
Developing a Provider Hosted SharePoint app
Developing a Provider Hosted SharePoint appDeveloping a Provider Hosted SharePoint app
Developing a Provider Hosted SharePoint app
 
Developing a provider hosted share point app
Developing a provider hosted share point appDeveloping a provider hosted share point app
Developing a provider hosted share point app
 
Introduction to F# 3.0
Introduction to F# 3.0Introduction to F# 3.0
Introduction to F# 3.0
 
Welcome to windows 8
Welcome to windows 8Welcome to windows 8
Welcome to windows 8
 
Exploring SharePoint with F#
Exploring SharePoint with F#Exploring SharePoint with F#
Exploring SharePoint with F#
 
Automating PowerShell with SharePoint
Automating PowerShell with SharePointAutomating PowerShell with SharePoint
Automating PowerShell with SharePoint
 
F# And Silverlight
F# And SilverlightF# And Silverlight
F# And Silverlight
 
SharePoint Saturday Boston 2010
SharePoint Saturday Boston 2010SharePoint Saturday Boston 2010
SharePoint Saturday Boston 2010
 
Automating SQL Server Database Creation for SharePoint
Automating SQL Server Database Creation for SharePointAutomating SQL Server Database Creation for SharePoint
Automating SQL Server Database Creation for SharePoint
 
Introduction to F#
Introduction to F#Introduction to F#
Introduction to F#
 
Architecting Solutions for the Manycore Future
Architecting Solutions for the Manycore FutureArchitecting Solutions for the Manycore Future
Architecting Solutions for the Manycore Future
 

Recently uploaded

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 

Recently uploaded (20)

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 

PowerShell and SharePoint

  • 1. PowerShell and SharePoint Talbott Crowell April 28, 2012 SharePoint Saturday Boston #SPSBOS http://www.thirdm.com @talbott
  • 2. What is PowerShell? • Unix-like shell • Object oriented • .NET • Command line • Scripting language www.sharepointsaturday.org/boston::WEB http://www.thirdm.com WEB http://talbottcrowell.wordpress.com::EMAIL SPSBoston@live.com BLOG @talbott : TWITTER @SPSBoston / #SPSBos : TWITTER
  • 3. Why PowerShell for SharePoint? • Automated build and deploy • Rapid prototyping • Exploring “What If” scenarios • Developer onboarding • Administration automation www.sharepointsaturday.org/boston::WEB http://www.thirdm.com WEB http://talbottcrowell.wordpress.com::EMAIL SPSBoston@live.com BLOG @talbott : TWITTER @SPSBoston / #SPSBos : TWITTER
  • 4. When use PowerShell? • When you want to make your team more agile – Automation, automation, automation • When developing, your daily build is like the projects heartbeat – PowerShell can be the pacemaker • Testing – Use the PowerShell scripts to stand up an environment for running tests www.sharepointsaturday.org/boston::WEB http://www.thirdm.com WEB http://talbottcrowell.wordpress.com::EMAIL SPSBoston@live.com BLOG @talbott : TWITTER @SPSBoston / #SPSBos : TWITTER
  • 5. PowerShell Basics • What do you know about a command line? – DIR • How about – $a = DIR • What is $a? – .NET Object • use gm or get-member to query properites – Array • $a[0] www.sharepointsaturday.org/boston::WEB http://www.thirdm.com WEB http://talbottcrowell.wordpress.com::EMAIL SPSBoston@live.com BLOG @talbott : TWITTER @SPSBoston / #SPSBos : TWITTER
  • 6. Demo - Basics • PowerShell Basics – $a = DIR – $a | gm – Dates www.sharepointsaturday.org/boston::WEB http://www.thirdm.com WEB http://talbottcrowell.wordpress.com::EMAIL SPSBoston@live.com BLOG @talbott : TWITTER @SPSBoston / #SPSBos : TWITTER
  • 7. Tools • cmd, notepad • PowerShell Command • Windows PowerShell Integrated Scripting Environment (ISE) – Import-Module ServerManager; – Add-WindowsFeature PowerShell-ISE • PowerGUI – Download from powergui.org www.sharepointsaturday.org/boston::WEB http://www.thirdm.com WEB http://talbottcrowell.wordpress.com::EMAIL SPSBoston@live.com BLOG @talbott : TWITTER @SPSBoston / #SPSBos : TWITTER
  • 8. More Basics • # for comment • Verb-Noun convention for commandlets • Write-Host “Hello World” • Set-ExecutionPolicy Unrestricted • .scriptname to execute www.sharepointsaturday.org/boston::WEB http://www.thirdm.com WEB http://talbottcrowell.wordpress.com::EMAIL SPSBoston@live.com BLOG @talbott : TWITTER @SPSBoston / #SPSBos : TWITTER
  • 9. SharePoint 2010 • Comes with PowerShell Commandlets – Get-SPSite – New-SPSite – New-SPWeb • If you are running from standard PowerShell Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue www.sharepointsaturday.org/boston::WEB http://www.thirdm.com WEB http://talbottcrowell.wordpress.com::EMAIL SPSBoston@live.com BLOG @talbott : TWITTER @SPSBoston / #SPSBos : TWITTER
  • 10. Create Site Collections and Sites • Get-SPSite – Parameter: url • New-SPSite – Parameters: url, name, ownerAlias, template • New-SPWeb – Parameters: url, name, description, template… – Other params: • -AddToTopNav or -UseParentTopNav • -AddToQuickLaunch www.sharepointsaturday.org/boston::WEB http://www.thirdm.com WEB http://talbottcrowell.wordpress.com::EMAIL SPSBoston@live.com BLOG @talbott : TWITTER @SPSBoston / #SPSBos : TWITTER
  • 11. What about MOSS 2007 or WSS? • Your friend STSADM is still there • You can call STSADM or any command line tool from PowerShell • You can write your own command line tools with .NET • Better yet, you can write your own PowerShell Commandlets! – Inherit from Cmdlet or PSCmdlet • Gary Lapointe has WSS and MOSS Cmdlets! – http://stsadm.blogspot.com/2009/02/downloads.html www.sharepointsaturday.org/boston::WEB http://www.thirdm.com WEB http://talbottcrowell.wordpress.com::EMAIL SPSBoston@live.com BLOG @talbott : TWITTER @SPSBoston / #SPSBos : TWITTER
  • 12. Creating SharePoint 2010 Cmdlets • When creating non-persistent tasks (i.e. get info) use: – SPCmdlet • When objects persist between commands, use: – SPRemoveCmdletBase – SPNewCmdletBase – SPSetCmdletBase – SPGetCmdletBase • For more info, see Gary Lapointe’s blog post: – http://stsadm.blogspot.com/2009/10/creating-custom- sharepoint-2010-cmdlets.html www.sharepointsaturday.org/boston::WEB http://www.thirdm.com WEB http://talbottcrowell.wordpress.com::EMAIL SPSBoston@live.com BLOG @talbott : TWITTER @SPSBoston / #SPSBos : TWITTER
  • 13. Creating SharePoint Objects • [void][System.Reflection.Assembly]::LoadWithPar tialName(”Microsoft.SharePoint”) – Load the assembly • $SPSite = New-Object Microsoft.SharePoint.SPSite($url) – Reference to the site collection using SharePoint object model • Don’t forget to – $SPSite.Dispose() www.sharepointsaturday.org/boston::WEB http://www.thirdm.com WEB http://talbottcrowell.wordpress.com::EMAIL SPSBoston@live.com BLOG @talbott : TWITTER @SPSBoston / #SPSBos : TWITTER
  • 14. Strategy • Series of scripts to build your site • Cleanup script to destroy site • Edit script, run cleanup, run script, view site – Repeat www.sharepointsaturday.org/boston::WEB http://www.thirdm.com WEB http://talbottcrowell.wordpress.com::EMAIL SPSBoston@live.com BLOG @talbott : TWITTER @SPSBoston / #SPSBos : TWITTER
  • 15. Demo – series of scripts • Build2010.ps1 – Calls other scripts • Build2010_site_structure.ps1 – Sets up the basic site structure and content types • Build2010_upload_file.ps1 – Uploads sample files to the site • Build2010_set_logo.ps1 – Adds site logo • Build2010_add_users.ps1 – Adds users to local machine and/or SharePoint groups www.sharepointsaturday.org/boston::WEB http://www.thirdm.com WEB http://talbottcrowell.wordpress.com::EMAIL SPSBoston@live.com BLOG @talbott : TWITTER @SPSBoston / #SPSBos : TWITTER
  • 16. Defining functions • function Get-Theme ([Microsoft.SharePoint.SPWeb]$SPWeb, [string]$themeName) • Strong typed parameters • Returns Microsoft.SharePoint.Utilities.ThmxTheme www.sharepointsaturday.org/boston::WEB http://www.thirdm.com WEB http://talbottcrowell.wordpress.com::EMAIL SPSBoston@live.com BLOG @talbott : TWITTER @SPSBoston / #SPSBos : TWITTER
  • 17. Iteration Style Scripts • Upload File – Takes in 1 or more files • Has 3 blocks – Begin – Process – End • Process is executed for each file • gci 'C:uploadfilesSamplesLegal' | .build2010_upload_file.ps1 -Location "shared/legal" - DocLib "Documents" -ContentType "Document" - MetaDataField "Dept" -MetaDataValue "Legal" www.sharepointsaturday.org/boston::WEB http://www.thirdm.com WEB http://talbottcrowell.wordpress.com::EMAIL SPSBoston@live.com BLOG @talbott : TWITTER @SPSBoston / #SPSBos : TWITTER
  • 18. Other References • How to: Build a SharePoint 2010 PowerShell Cmdlet – http://silverlight.sys-con.com/node/1370916 www.sharepointsaturday.org/boston::WEB http://www.thirdm.com WEB http://talbottcrowell.wordpress.com::EMAIL SPSBoston@live.com BLOG @talbott : TWITTER @SPSBoston / #SPSBos : TWITTER
  • 19. Thank you. Questions? PowerShell and SharePoint Talbott Crowell ThirdM.com http://talbottcrowell.wordpress.com/ Twitter: @talbott