SlideShare ist ein Scribd-Unternehmen logo
1 von 24
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

Weitere ähnliche Inhalte

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 

Kürzlich hochgeladen (20)

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

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