Movatterモバイル変換


[0]ホーム

URL:


SlideShare a Scribd company logo

PowerShell and SharePoint

Download as PPTX, PDF
0 likes858 views
Talbott Crowell
Talbott Crowell

The document discusses the integration of PowerShell with SharePoint, highlighting its benefits such as automation, rapid prototyping, and administrative tasks. It covers key PowerShell basics, commandlets for SharePoint 2010, and the process of creating and managing SharePoint objects. In addition, it provides guidance on scripting strategies and functions to enhance development workflows in SharePoint environments.

1 of 19
Downloaded 30 times
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
PowerShell and SharePoint       Talbott Crowell           April 28, 2012SharePoint 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.comhttp://talbottcrowell.wordpress.com/         Twitter: @talbott
Ad

Recommended

PPTX
PowerShell for sharepoint 2010 administrators
Ravikanth Chaganti
 
PDF
PowerShell for SharePoint Developers
Boulos Dib
 
PPTX
PowerShell for SharePoint Admins
Rick Taylor
 
PPTX
SP24S053 Introduction to PowerShell for SharePoint Developers and Administrators
Michael Blumenthal (Microsoft MVP)
 
PPTX
Power shell for sp admins
Rick Taylor
 
KEY
WordPress APIs
mdawaffe
 
PPTX
Best Practices for WordPress in Enterprise
Taylor Lovett
 
PDF
JSON REST API for WordPress
Taylor Lovett
 
PDF
Isomorphic WordPress Applications with NodeifyWP
Taylor Lovett
 
PDF
JSON REST API for WordPress
Taylor Lovett
 
PPTX
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
Ricardo Wilkins
 
PDF
Unlocking the Magical Powers of WP_Query
Dustin Filippini
 
PDF
Fluxible
Taylor Lovett
 
PDF
Best Practices for WordPress
Taylor Lovett
 
PDF
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
Cliff Seal
 
PPTX
Best Practices for Building WordPress Applications
Taylor Lovett
 
PPTX
Intro to SharePoint + PowerShell
Ryan Dennis
 
PPTX
40+ tips to use Postman more efficiently
postmanclient
 
PDF
Stress Free Deployment - Confoo 2011
Bachkoutou Toutou
 
PDF
Here Be Dragons - Debugging WordPress
Rami Sayar
 
PPTX
Varying wordpressdevelopmentenvironment wp-campus2016
David Brattoli
 
ODP
Multi tenant CMSes using php
kae-verens
 
PDF
YAPC::EU 2015 - Perl Conferences
ℕicolas ℝ.
 
PPTX
Introduction to Laravel
Vin Lim
 
PDF
How Ansible Makes Automation Easy
Peter Sankauskas
 
PDF
High Performance Drupal
Jeff Geerling
 
PPTX
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
Sencha
 
PDF
Selenium Tips & Tricks - StarWest 2015
Andrew Krug
 
PPTX
PowerShell and SharePoint @spsnyc July 2012
Talbott Crowell
 
PPTX
Building a Reddit Clone from the Ground Up
UCLA Association of Computing Machinery
 

More Related Content

What's hot(20)

PDF
Isomorphic WordPress Applications with NodeifyWP
Taylor Lovett
 
PDF
JSON REST API for WordPress
Taylor Lovett
 
PPTX
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
Ricardo Wilkins
 
PDF
Unlocking the Magical Powers of WP_Query
Dustin Filippini
 
PDF
Fluxible
Taylor Lovett
 
PDF
Best Practices for WordPress
Taylor Lovett
 
PDF
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
Cliff Seal
 
PPTX
Best Practices for Building WordPress Applications
Taylor Lovett
 
PPTX
Intro to SharePoint + PowerShell
Ryan Dennis
 
PPTX
40+ tips to use Postman more efficiently
postmanclient
 
PDF
Stress Free Deployment - Confoo 2011
Bachkoutou Toutou
 
PDF
Here Be Dragons - Debugging WordPress
Rami Sayar
 
PPTX
Varying wordpressdevelopmentenvironment wp-campus2016
David Brattoli
 
ODP
Multi tenant CMSes using php
kae-verens
 
PDF
YAPC::EU 2015 - Perl Conferences
ℕicolas ℝ.
 
PPTX
Introduction to Laravel
Vin Lim
 
PDF
How Ansible Makes Automation Easy
Peter Sankauskas
 
PDF
High Performance Drupal
Jeff Geerling
 
PPTX
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
Sencha
 
PDF
Selenium Tips & Tricks - StarWest 2015
Andrew Krug
 
Isomorphic WordPress Applications with NodeifyWP
Taylor Lovett
 
JSON REST API for WordPress
Taylor Lovett
 
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
Ricardo Wilkins
 
Unlocking the Magical Powers of WP_Query
Dustin Filippini
 
Fluxible
Taylor Lovett
 
Best Practices for WordPress
Taylor Lovett
 
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
Cliff Seal
 
Best Practices for Building WordPress Applications
Taylor Lovett
 
Intro to SharePoint + PowerShell
Ryan Dennis
 
40+ tips to use Postman more efficiently
postmanclient
 
Stress Free Deployment - Confoo 2011
Bachkoutou Toutou
 
Here Be Dragons - Debugging WordPress
Rami Sayar
 
Varying wordpressdevelopmentenvironment wp-campus2016
David Brattoli
 
Multi tenant CMSes using php
kae-verens
 
YAPC::EU 2015 - Perl Conferences
ℕicolas ℝ.
 
Introduction to Laravel
Vin Lim
 
How Ansible Makes Automation Easy
Peter Sankauskas
 
High Performance Drupal
Jeff Geerling
 
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
Sencha
 
Selenium Tips & Tricks - StarWest 2015
Andrew Krug
 

Similar to PowerShell and SharePoint(20)

PPTX
PowerShell and SharePoint @spsnyc July 2012
Talbott Crowell
 
PPTX
Building a Reddit Clone from the Ground Up
UCLA Association of Computing Machinery
 
PPTX
Introduction to PowerShell for SharePoint Admins and Developers
Michael Blumenthal (Microsoft MVP)
 
PPTX
Power to the People: Manipulating SharePoint with Client-Side JavaScript
PeterBrunone
 
PDF
Automating everything with Microsoft Flow
Jaap Brasser
 
PPTX
Drew madelung sp designer workflows - sp-biz
Drew Madelung
 
PPTX
Building End User Productivity into your SharePoint Planning #BASPUG
Christian Buckley
 
PPTX
SharePoint 2010 Application Lifecycle Management
Ivan Sanders
 
PDF
2015 nouveaux outilsdevweb
Philippe Antoine
 
PPTX
Share point development 101
Becky Bertram
 
PPTX
Chatbots
Tessa Mero
 
PDF
TDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecer
Stefan Teixeira
 
PDF
Frontend tooling and workflows
Dmitry Semigradsky
 
PDF
Identifying and solving enterprise problems
Vasu Jain
 
PPTX
Social Media Data
Will Simm
 
PPTX
Tech Ed Africa Share Point Infra Fundamentals
Joel Oleson
 
PDF
SQL Server PowerShell - Community Tools
Lars Platzdasch
 
PPTX
Quick & Easy SharePoint Forms with StratusForms
April Dunnam
 
PPTX
BotCommons: Metadata for Bots - Devoxx 2017
Cisco DevNet
 
PPT
WordPress SEO on Drugs!
Simon Sundén
 
PowerShell and SharePoint @spsnyc July 2012
Talbott Crowell
 
Building a Reddit Clone from the Ground Up
UCLA Association of Computing Machinery
 
Introduction to PowerShell for SharePoint Admins and Developers
Michael Blumenthal (Microsoft MVP)
 
Power to the People: Manipulating SharePoint with Client-Side JavaScript
PeterBrunone
 
Automating everything with Microsoft Flow
Jaap Brasser
 
Drew madelung sp designer workflows - sp-biz
Drew Madelung
 
Building End User Productivity into your SharePoint Planning #BASPUG
Christian Buckley
 
SharePoint 2010 Application Lifecycle Management
Ivan Sanders
 
2015 nouveaux outilsdevweb
Philippe Antoine
 
Share point development 101
Becky Bertram
 
Chatbots
Tessa Mero
 
TDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecer
Stefan Teixeira
 
Frontend tooling and workflows
Dmitry Semigradsky
 
Identifying and solving enterprise problems
Vasu Jain
 
Social Media Data
Will Simm
 
Tech Ed Africa Share Point Infra Fundamentals
Joel Oleson
 
SQL Server PowerShell - Community Tools
Lars Platzdasch
 
Quick & Easy SharePoint Forms with StratusForms
April Dunnam
 
BotCommons: Metadata for Bots - Devoxx 2017
Cisco DevNet
 
WordPress SEO on Drugs!
Simon Sundén
 
Ad

More from Talbott Crowell(18)

PPTX
Talbott's brief History of Computers for CollabDays Hamburg 2025
Talbott Crowell
 
PPTX
Top 7 mistakes
Talbott Crowell
 
PPTX
Top 3 Mistakes when Building
Talbott Crowell
 
PPTX
Building high performance and scalable share point applications
Talbott Crowell
 
PPTX
Road to the Cloud - Extending your reach with SharePoint and Office 365
Talbott Crowell
 
PPTX
Custom Development for SharePoint
Talbott Crowell
 
PPTX
Custom Development in SharePoint – What are my options now?
Talbott Crowell
 
PPTX
Developing a Provider Hosted SharePoint app
Talbott Crowell
 
PPTX
Developing a provider hosted share point app
Talbott Crowell
 
PPTX
Introduction to F# 3.0
Talbott Crowell
 
PPTX
Welcome to windows 8
Talbott Crowell
 
PPTX
Exploring SharePoint with F#
Talbott Crowell
 
PPTX
Automating PowerShell with SharePoint
Talbott Crowell
 
PPTX
F# And Silverlight
Talbott Crowell
 
PPTX
SharePoint Saturday Boston 2010
Talbott Crowell
 
PPT
Automating SQL Server Database Creation for SharePoint
Talbott Crowell
 
PPTX
Introduction to F#
Talbott Crowell
 
PPTX
Architecting Solutions for the Manycore Future
Talbott Crowell
 
Talbott's brief History of Computers for CollabDays Hamburg 2025
Talbott Crowell
 
Top 7 mistakes
Talbott Crowell
 
Top 3 Mistakes when Building
Talbott Crowell
 
Building high performance and scalable share point applications
Talbott Crowell
 
Road to the Cloud - Extending your reach with SharePoint and Office 365
Talbott Crowell
 
Custom Development for SharePoint
Talbott Crowell
 
Custom Development in SharePoint – What are my options now?
Talbott Crowell
 
Developing a Provider Hosted SharePoint app
Talbott Crowell
 
Developing a provider hosted share point app
Talbott Crowell
 
Introduction to F# 3.0
Talbott Crowell
 
Welcome to windows 8
Talbott Crowell
 
Exploring SharePoint with F#
Talbott Crowell
 
Automating PowerShell with SharePoint
Talbott Crowell
 
F# And Silverlight
Talbott Crowell
 
SharePoint Saturday Boston 2010
Talbott Crowell
 
Automating SQL Server Database Creation for SharePoint
Talbott Crowell
 
Introduction to F#
Talbott Crowell
 
Architecting Solutions for the Manycore Future
Talbott Crowell
 
Ad

Recently uploaded(20)

PPTX
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PDF
Persuasive AI: risks and opportunities in the age of digital debate
Speck&Tech
 
PDF
Apache CloudStack 201: Let's Design & Build an IaaS Cloud
ShapeBlue
 
PDF
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PPTX
Darren Mills The Migration Modernization Balancing Act: Navigating Risks and...
AWS Chicago
 
PDF
Wojciech Ciemski for Top Cyber News MAGAZINE. June 2025
Dr. Ludmila Morozova-Buss
 
PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
PDF
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PPTX
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
PDF
July Patch Tuesday
Ivanti
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Meetup Kickoff & Welcome - Rohit Yadav, CSIUG Chairman
ShapeBlue
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
Persuasive AI: risks and opportunities in the age of digital debate
Speck&Tech
 
Apache CloudStack 201: Let's Design & Build an IaaS Cloud
ShapeBlue
 
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Darren Mills The Migration Modernization Balancing Act: Navigating Risks and...
AWS Chicago
 
Wojciech Ciemski for Top Cyber News MAGAZINE. June 2025
Dr. Ludmila Morozova-Buss
 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
July Patch Tuesday
Ivanti
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Meetup Kickoff & Welcome - Rohit Yadav, CSIUG Chairman
ShapeBlue
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 

PowerShell and SharePoint

  • 1.PowerShell and SharePoint Talbott Crowell April 28, 2012SharePoint 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.comhttp://talbottcrowell.wordpress.com/ Twitter: @talbott

[8]ページ先頭

©2009-2025 Movatter.jp