SlideShare une entreprise Scribd logo
1  sur  24
Télécharger pour lire hors ligne
Talbott Crowell
           July 28, 2012
SharePoint Saturday NYC #SPSNYC

     http://www.thirdm.com
            @talbott
•   What is PowerShell?
•   PowerShell Basics
•   Tools
•   PowerShell and SharePoint
•   Creating SharePoint 2010 Cmdlets
•   Iteration Style Scripts

                             www.sharepointsaturday.org/boston::WEB
                                            http://www.thirdm.com WEB
                               http://talbottcrowell.wordpress.com::EMAIL
                                          SPSBoston@live.com BLOG
                                                       @talbott : TWITTER
                                     @SPSBoston / #SPSBos : TWITTER
•   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
• Windows PowerShell in Action
   – by Bruce Payette
     (designer and author of PowerShell)



• Windows PowerShell 2.0
  Administrator's Pocket Consultant
   – By William R. Stanek




                                           www.sharepointsaturday.org/boston::WEB
                                                          http://www.thirdm.com WEB
                                             http://talbottcrowell.wordpress.com::EMAIL
                                                        SPSBoston@live.com BLOG
                                                                     @talbott : TWITTER
                                                   @SPSBoston / #SPSBos : TWITTER
•   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 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
• 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
• 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
• 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
•   # 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
• 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
• 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
• 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
• 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
• [void][System.Reflection.Assembly]::LoadWith
  PartialName(”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
• 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
• 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
• 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
• 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
• Windows PowerShell in Action
   – by Bruce Payette
     (designer and author of PowerShell)



• Windows PowerShell 2.0
  Administrator's Pocket Consultant
   – By William R. Stanek




                                           www.sharepointsaturday.org/boston::WEB
                                                          http://www.thirdm.com WEB
                                             http://talbottcrowell.wordpress.com::EMAIL
                                                        SPSBoston@live.com BLOG
                                                                     @talbott : TWITTER
                                                   @SPSBoston / #SPSBos : TWITTER
• How to: Build a SharePoint 2010 PowerShell Cmdlet
   – http://silverlight.sys-con.com/node/1370916


• Microsoft TechNet
   – http://technet.microsoft.com/en-us/library/bb978526




                                           www.sharepointsaturday.org/boston::WEB
                                                          http://www.thirdm.com WEB
                                             http://talbottcrowell.wordpress.com::EMAIL
                                                        SPSBoston@live.com BLOG
                                                                     @talbott : TWITTER
                                                   @SPSBoston / #SPSBos : TWITTER
• Please remember to turn in your filled out
  bingo cards and event evaluations for prizes.

• SharePint is sponsored by Summit 7 Systems
  across the way at the Hilton NYC.

• Follow SharePoint Saturday New York City on
  Twitter @spsnyc and hashtag #spsnyc

                                      22   | SharePoint Saturday New York City 2011
Thanks to Our Sponsors!
Talbott Crowell
           ThirdM.com
http://talbottcrowell.wordpress.com/
         Twitter: @talbott

Contenu connexe

Similaire à PowerShell and SharePoint @spsnyc July 2012

PowerShell and SharePoint
PowerShell and SharePointPowerShell and SharePoint
PowerShell and SharePointTalbott Crowell
 
2015 nouveaux outilsdevweb
2015 nouveaux outilsdevweb2015 nouveaux outilsdevweb
2015 nouveaux outilsdevwebPhilippe Antoine
 
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
 
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
 
How to not blow up spaceships
How to not blow up spaceshipsHow to not blow up spaceships
How to not blow up spaceshipsSabin Marcu
 
Curiosity Bits Python Tutorial: Mining Facebook Fan Page - getting posts and ...
Curiosity Bits Python Tutorial: Mining Facebook Fan Page - getting posts and ...Curiosity Bits Python Tutorial: Mining Facebook Fan Page - getting posts and ...
Curiosity Bits Python Tutorial: Mining Facebook Fan Page - getting posts and ...Weiai Wayne Xu
 
Lab305 Django Facebook Connect Integration Example
Lab305 Django Facebook Connect Integration ExampleLab305 Django Facebook Connect Integration Example
Lab305 Django Facebook Connect Integration ExampleMichael Trosen
 
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
 
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
 
SELECT * FROM Internet: Using the Yahoo! Query Language
SELECT * FROM Internet: Using the Yahoo! Query LanguageSELECT * FROM Internet: Using the Yahoo! Query Language
SELECT * FROM Internet: Using the Yahoo! Query Languagebdeshong
 
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)
 
Life of a fragment of history
Life of a fragment of historyLife of a fragment of history
Life of a fragment of historyYvonne Perkins
 
Stop Reinventing The Wheel - The Ruby Standard Library
Stop Reinventing The Wheel - The Ruby Standard LibraryStop Reinventing The Wheel - The Ruby Standard Library
Stop Reinventing The Wheel - The Ruby Standard LibraryBrian Hogan
 
Automating everything with Microsoft Flow
Automating everything with Microsoft FlowAutomating everything with Microsoft Flow
Automating everything with Microsoft FlowJaap Brasser
 
BotCommons: Metadata for Bots - Devoxx 2017
BotCommons: Metadata for Bots - Devoxx 2017BotCommons: Metadata for Bots - Devoxx 2017
BotCommons: Metadata for Bots - Devoxx 2017Cisco DevNet
 
Pwning the Enterprise With PowerShell
Pwning the Enterprise With PowerShellPwning the Enterprise With PowerShell
Pwning the Enterprise With PowerShellBeau Bullock
 

Similaire à PowerShell and SharePoint @spsnyc July 2012 (20)

PowerShell and SharePoint
PowerShell and SharePointPowerShell and SharePoint
PowerShell and SharePoint
 
2015 nouveaux outilsdevweb
2015 nouveaux outilsdevweb2015 nouveaux outilsdevweb
2015 nouveaux outilsdevweb
 
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
 
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
 
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
 
How to not blow up spaceships
How to not blow up spaceshipsHow to not blow up spaceships
How to not blow up spaceships
 
Curiosity Bits Python Tutorial: Mining Facebook Fan Page - getting posts and ...
Curiosity Bits Python Tutorial: Mining Facebook Fan Page - getting posts and ...Curiosity Bits Python Tutorial: Mining Facebook Fan Page - getting posts and ...
Curiosity Bits Python Tutorial: Mining Facebook Fan Page - getting posts and ...
 
Lab305 Django Facebook Connect Integration Example
Lab305 Django Facebook Connect Integration ExampleLab305 Django Facebook Connect Integration Example
Lab305 Django Facebook Connect Integration Example
 
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
 
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
 
SELECT * FROM Internet: Using the Yahoo! Query Language
SELECT * FROM Internet: Using the Yahoo! Query LanguageSELECT * FROM Internet: Using the Yahoo! Query Language
SELECT * FROM Internet: Using the Yahoo! Query Language
 
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
 
Life of a fragment of history
Life of a fragment of historyLife of a fragment of history
Life of a fragment of history
 
Stop Reinventing The Wheel - The Ruby Standard Library
Stop Reinventing The Wheel - The Ruby Standard LibraryStop Reinventing The Wheel - The Ruby Standard Library
Stop Reinventing The Wheel - The Ruby Standard Library
 
Automating everything with Microsoft Flow
Automating everything with Microsoft FlowAutomating everything with Microsoft Flow
Automating everything with Microsoft Flow
 
Great 8
Great 8Great 8
Great 8
 
BotCommons: Metadata for Bots - Devoxx 2017
BotCommons: Metadata for Bots - Devoxx 2017BotCommons: Metadata for Bots - Devoxx 2017
BotCommons: Metadata for Bots - Devoxx 2017
 
Pwning the Enterprise With PowerShell
Pwning the Enterprise With PowerShellPwning the Enterprise With PowerShell
Pwning the Enterprise With PowerShell
 

Plus de Talbott 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
 
Architecting Solutions for the Manycore Future
Architecting Solutions for the Manycore FutureArchitecting Solutions for the Manycore Future
Architecting Solutions for the Manycore FutureTalbott Crowell
 

Plus de Talbott Crowell (12)

Top 7 mistakes
Top 7 mistakesTop 7 mistakes
Top 7 mistakes
 
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
 
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
 

Dernier

20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDELiveplex
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 

Dernier (20)

20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 

PowerShell and SharePoint @spsnyc July 2012

  • 1. Talbott Crowell July 28, 2012 SharePoint Saturday NYC #SPSNYC http://www.thirdm.com @talbott
  • 2. What is PowerShell? • PowerShell Basics • Tools • PowerShell and SharePoint • Creating SharePoint 2010 Cmdlets • Iteration Style Scripts 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. 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
  • 4. • Windows PowerShell in Action – by Bruce Payette (designer and author of PowerShell) • Windows PowerShell 2.0 Administrator's Pocket Consultant – By William R. Stanek 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. 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
  • 6. • 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
  • 7. • 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
  • 8. • 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
  • 9. • 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
  • 10. # 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
  • 11. • 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
  • 12. • 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
  • 13. • 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
  • 14. • 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
  • 15. • [void][System.Reflection.Assembly]::LoadWith PartialName(”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
  • 16. • 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
  • 17. • 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
  • 18. • 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
  • 19. • 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
  • 20. • Windows PowerShell in Action – by Bruce Payette (designer and author of PowerShell) • Windows PowerShell 2.0 Administrator's Pocket Consultant – By William R. Stanek www.sharepointsaturday.org/boston::WEB http://www.thirdm.com WEB http://talbottcrowell.wordpress.com::EMAIL SPSBoston@live.com BLOG @talbott : TWITTER @SPSBoston / #SPSBos : TWITTER
  • 21. • How to: Build a SharePoint 2010 PowerShell Cmdlet – http://silverlight.sys-con.com/node/1370916 • Microsoft TechNet – http://technet.microsoft.com/en-us/library/bb978526 www.sharepointsaturday.org/boston::WEB http://www.thirdm.com WEB http://talbottcrowell.wordpress.com::EMAIL SPSBoston@live.com BLOG @talbott : TWITTER @SPSBoston / #SPSBos : TWITTER
  • 22. • Please remember to turn in your filled out bingo cards and event evaluations for prizes. • SharePint is sponsored by Summit 7 Systems across the way at the Hilton NYC. • Follow SharePoint Saturday New York City on Twitter @spsnyc and hashtag #spsnyc 22 | SharePoint Saturday New York City 2011
  • 23. Thanks to Our Sponsors!
  • 24. Talbott Crowell ThirdM.com http://talbottcrowell.wordpress.com/ Twitter: @talbott