Movatterモバイル変換


[0]ホーム

URL:


SlideShare a Scribd company logo

Automating PowerShell with SharePoint

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

PowerShell is a scripting language and command-line shell that can be used to automate administration tasks and rapidly prototype solutions for SharePoint. It provides commands to create and interact with SharePoint sites, lists, and libraries. PowerShell scripts can be used to automate repetitive tasks like building test environments or deploying updates. Custom PowerShell cmdlets can also be created to extend its capabilities with SharePoint.

1 of 19
Downloaded 49 times
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
PowerShell SharePointTalbott CrowellSPSBoston, September 25, 2010http://www.thirdm.com
Unix-like shellObject oriented.NETCommand lineScripting languageWhat is PowerShell?
Automated build and deployRapid prototypingExploring “What If” scenariosDeveloper onboardingAdministration automationWhy PowerShell for SharePoint?
When you want to make your team more agileAutomation, automation, automationWhen developing, your daily build is like the projects heartbeatPowerShell can be the pacemakerTestingUse the PowerShell scripts to stand up an environment for running testsWhen use PowerShell?
What do you know about a command line?DIRHow about$a = DIRWhat is $a?.NET Objectuse gm or get-member to query properitesArray$a[0]PowerShell Basics
PowerShell Basics$a = DIR$a | gmDatesDemo - Basics
Cmd, notepadPowerShell CommandWindows PowerShell Integrated Scripting Environment (ISE)Import-Module ServerManager;Add-WindowsFeaturePowerShell-ISE PowerGUIDownload from powergui.orgTools
# for commentVerb-Noun convention for commandletsWrite-Host “Hello World”Set-ExecutionPolicyUnrestricted.\scriptname to executeMore Basics
Comes with PowerShell CommandletsGet-SPSiteNew-SPSiteNew-SPWebIf you are running from standard PowerShellAdd-PSSnapinmicrosoft.sharepoint.powershell-ErrorActionSilentlyContinueSharePoint 2010
Get-SPSiteParameter: urlNew-SPSiteParameters: url, name, ownerAlias, templateNew-SPWebParameters: url, name, description, template…Other params: -AddToTopNav or -UseParentTopNav-AddToQuickLaunchCreate Site Collections and Sites
Your friend STSADM is still thereYou can call STSADM or any command line tool from PowerShellYou can write your own command line tools with .NETBetter yet, you can write your own PowerShell Commandlets!Inherit from Cmdletor PSCmdletGary Lapointe has WSS and MOSS Cmdlets!http://stsadm.blogspot.com/2009/02/downloads.htmlWhat about MOSS 2007 or WSS?
When creating non-persistent tasks (i.e. get info) use:SPCmdletWhen objects persist between commands, use:SPRemoveCmdletBaseSPNewCmdletBaseSPSetCmdletBaseSPGetCmdletBaseFor more info, see Gary Lapointe’s blog post:http://stsadm.blogspot.com/2009/10/creating-custom-sharepoint-2010-cmdlets.htmlCreating SharePoint 2010 Cmdlets
[void][System.Reflection.Assembly]::LoadWithPartialName(”Microsoft.SharePoint”)Load the assembly$SPSite = New-ObjectMicrosoft.SharePoint.SPSite($url)Reference to the site collection using SharePoint object modelDon’t forget to$SPSite.Dispose()Creating SharePoint Objects
Series of scripts to build your siteCleanup script to destroy siteEdit script, run cleanup, run script, view siteRepeatStrategy
Build2010.ps1Calls other scriptsBuild2010_site_structure.ps1Sets up the basic site structure and content typesBuild2010_upload_file.ps1Uploads sample files to the siteBuild2010_set_logo.ps1Adds site logoBuild2010_add_users.ps1Adds users to local machine and/or SharePoint groupsDemo – series of scripts
function Get-Theme([Microsoft.SharePoint.SPWeb]$SPWeb,[string]$themeName)Strong typed parametersReturns Microsoft.SharePoint.Utilities.ThmxThemeDefining functions
Upload FileTakes in 1 or more filesHas 3 blocksBeginProcessEndProcess is executed for each filegci 'C:\uploadfiles\Samples\Legal'  | .\build2010_upload_file.ps1 -Location "shared/legal" -DocLib "Documents" -ContentType "Document" -MetaDataField "Dept" -MetaDataValue "Legal"Iteration Style Scripts
How to: Build a SharePoint 2010 PowerShell Cmdlethttp://silverlight.sys-con.com/node/1370916Other References
Thank you. Questions?PowerShell SharePointTalbott CrowellThirdM.comhttp://talbottc.spaces.live.comTwitter: @talbott
Ad

Recommended

PPTX
Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT
Maarten Balliauw
 
PDF
Puppeteer - Headless Chrome Node API
Wilson Su
 
PDF
SEP DevOps Ignite Talk - Packer
Ryan Sweeney
 
PDF
F5 Automation and service discovery
Scott van Kalken
 
PDF
DevOps - Infrastructure as Code by Andre Marcelo-Tanner
DEVCON
 
PDF
macos installation automation
Jon Fuller
 
PDF
Docker slides
Jyotsna Raghuraman
 
PDF
Case study: JBoss Developer Studio, an IDE for Web, Mobile and Cloud applicat...
Max Andersen
 
PDF
10 things every developer should know about their database to run word press ...
Otto Kekäläinen
 
PDF
Firebase slide
Apaichon Punopas
 
PPTX
Cyansible
Alan Norton
 
PDF
Ruby on Rails Kickstart 101 & 102
Heng-Yi Wu
 
ODP
Drupal7
guest0b5da
 
PDF
Ansible testing
Scott van Kalken
 
PPTX
Troubleshooting Apache CloudStack at #ccceu14 by @jorizvl
Joris van Lieshout
 
PDF
Cialug August 2021
Andrew Denner
 
PPTX
Package Management on Windows with Chocolatey
Puppet
 
PDF
What makes me "Grunt"?
Fabien Doiron
 
PPTX
Setting up Kubernetes with tectonic
Vishal Biyani
 
PDF
Ansible and AWS
Peter Sankauskas
 
PDF
빈스톡 첫인상 with Git
AWSKRUG - AWS한국사용자모임
 
PPTX
Ansible: How to Get More Sleep and Require Less Coffee
Sarah Z
 
PDF
Tips and Tricks for Automating Windows with Chef
Chef Software, Inc.
 
PDF
Deploying PHP Applications with Ansible
Orestes Carracedo
 
PDF
Node intro
Vishal Sharma
 
PDF
Testing Ansible with Jenkins and Docker
Dennis Rowe
 
PDF
Docker in Production - IPC 15 München
Robert Lemke
 
PPTX
Basics of Ansible - Sahil Davawala
Sahil Davawala
 
PPTX
Introduction to PowerShell for SharePoint - SharePointFest 2014 workshop
Michael Blumenthal (Microsoft MVP)
 
PPTX
Dogfood slides 2012
Ryan Dennis
 

More Related Content

What's hot(20)

PDF
10 things every developer should know about their database to run word press ...
Otto Kekäläinen
 
PDF
Firebase slide
Apaichon Punopas
 
PPTX
Cyansible
Alan Norton
 
PDF
Ruby on Rails Kickstart 101 & 102
Heng-Yi Wu
 
ODP
Drupal7
guest0b5da
 
PDF
Ansible testing
Scott van Kalken
 
PPTX
Troubleshooting Apache CloudStack at #ccceu14 by @jorizvl
Joris van Lieshout
 
PDF
Cialug August 2021
Andrew Denner
 
PPTX
Package Management on Windows with Chocolatey
Puppet
 
PDF
What makes me "Grunt"?
Fabien Doiron
 
PPTX
Setting up Kubernetes with tectonic
Vishal Biyani
 
PDF
Ansible and AWS
Peter Sankauskas
 
PDF
빈스톡 첫인상 with Git
AWSKRUG - AWS한국사용자모임
 
PPTX
Ansible: How to Get More Sleep and Require Less Coffee
Sarah Z
 
PDF
Tips and Tricks for Automating Windows with Chef
Chef Software, Inc.
 
PDF
Deploying PHP Applications with Ansible
Orestes Carracedo
 
PDF
Node intro
Vishal Sharma
 
PDF
Testing Ansible with Jenkins and Docker
Dennis Rowe
 
PDF
Docker in Production - IPC 15 München
Robert Lemke
 
PPTX
Basics of Ansible - Sahil Davawala
Sahil Davawala
 
10 things every developer should know about their database to run word press ...
Otto Kekäläinen
 
Firebase slide
Apaichon Punopas
 
Cyansible
Alan Norton
 
Ruby on Rails Kickstart 101 & 102
Heng-Yi Wu
 
Drupal7
guest0b5da
 
Ansible testing
Scott van Kalken
 
Troubleshooting Apache CloudStack at #ccceu14 by @jorizvl
Joris van Lieshout
 
Cialug August 2021
Andrew Denner
 
Package Management on Windows with Chocolatey
Puppet
 
What makes me "Grunt"?
Fabien Doiron
 
Setting up Kubernetes with tectonic
Vishal Biyani
 
Ansible and AWS
Peter Sankauskas
 
빈스톡 첫인상 with Git
AWSKRUG - AWS한국사용자모임
 
Ansible: How to Get More Sleep and Require Less Coffee
Sarah Z
 
Tips and Tricks for Automating Windows with Chef
Chef Software, Inc.
 
Deploying PHP Applications with Ansible
Orestes Carracedo
 
Node intro
Vishal Sharma
 
Testing Ansible with Jenkins and Docker
Dennis Rowe
 
Docker in Production - IPC 15 München
Robert Lemke
 
Basics of Ansible - Sahil Davawala
Sahil Davawala
 

Viewers also liked(7)

PPTX
Introduction to PowerShell for SharePoint - SharePointFest 2014 workshop
Michael Blumenthal (Microsoft MVP)
 
PPTX
Dogfood slides 2012
Ryan Dennis
 
PPTX
Funnel your Info down a new Path
Ryan Dennis
 
PPTX
DAYSPUG - Funnel your info down a new path
Ryan Dennis
 
PPTX
ScarePoint Saturday Spookinnati Slides
Ryan Dennis
 
PPTX
Build your SharePoint Internet Presence with PowerShell
Ryan Dennis
 
PPTX
Spsatx slides (widescreen)
Ryan Dennis
 
Introduction to PowerShell for SharePoint - SharePointFest 2014 workshop
Michael Blumenthal (Microsoft MVP)
 
Dogfood slides 2012
Ryan Dennis
 
Funnel your Info down a new Path
Ryan Dennis
 
DAYSPUG - Funnel your info down a new path
Ryan Dennis
 
ScarePoint Saturday Spookinnati Slides
Ryan Dennis
 
Build your SharePoint Internet Presence with PowerShell
Ryan Dennis
 
Spsatx slides (widescreen)
Ryan Dennis
 
Ad

Similar to Automating PowerShell with SharePoint(20)

PDF
PowerShell for SharePoint Developers
Boulos Dib
 
PPTX
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
SharePoint Saturday NY
 
PPTX
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
SharePoint Saturday NY
 
PPTX
Intro to PowerShell
Adam Preston
 
PPTX
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
Comunidade Portuguesa de SharePoiint
 
PPTX
Introduction to windows power shell in sharepoint 2010
Binh Nguyen
 
PDF
Introduction to PowerShell
Boulos Dib
 
PPTX
Windows PowerShell - Billings .NET User Group - August 2009
John Clayton
 
PDF
Automating Your Enterprise Application Deployments with PowerShell
Geoff Varosky
 
PDF
Sql Server & PowerShell
Aaron Shilo
 
PPTX
Automating Your Enterprise Application Deployments With PowerShell by Geoff V...
SPTechCon
 
PPTX
Introduction to Powershell Version 5
Nishtha Kesarwani
 
PPTX
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Michael Blumenthal (Microsoft MVP)
 
PPTX
Getting Started With PowerShell Scripting
Ravikanth Chaganti
 
PPT
Powershell Seminar @ ITWorx CuttingEdge Club
Essam Salah
 
PPTX
SharePoint for the .NET Developer
John Calvert
 
PPT
No-script PowerShell v2
Concentrated Technology
 
DOCX
Power shell
Rajkiran Swain
 
PPTX
Power shell training
David Brabant
 
PDF
SPSToronto 2015 - Managing Office365 with PowerShell and CSOM
amitvasu
 
PowerShell for SharePoint Developers
Boulos Dib
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
SharePoint Saturday NY
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
SharePoint Saturday NY
 
Intro to PowerShell
Adam Preston
 
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
Comunidade Portuguesa de SharePoiint
 
Introduction to windows power shell in sharepoint 2010
Binh Nguyen
 
Introduction to PowerShell
Boulos Dib
 
Windows PowerShell - Billings .NET User Group - August 2009
John Clayton
 
Automating Your Enterprise Application Deployments with PowerShell
Geoff Varosky
 
Sql Server & PowerShell
Aaron Shilo
 
Automating Your Enterprise Application Deployments With PowerShell by Geoff V...
SPTechCon
 
Introduction to Powershell Version 5
Nishtha Kesarwani
 
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Michael Blumenthal (Microsoft MVP)
 
Getting Started With PowerShell Scripting
Ravikanth Chaganti
 
Powershell Seminar @ ITWorx CuttingEdge Club
Essam Salah
 
SharePoint for the .NET Developer
John Calvert
 
No-script PowerShell v2
Concentrated Technology
 
Power shell
Rajkiran Swain
 
Power shell training
David Brabant
 
SPSToronto 2015 - Managing Office365 with PowerShell and CSOM
amitvasu
 
Ad

More from Talbott Crowell(19)

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
PowerShell and SharePoint @spsnyc July 2012
Talbott Crowell
 
PPTX
PowerShell and SharePoint
Talbott Crowell
 
PPTX
Welcome to windows 8
Talbott Crowell
 
PPTX
Exploring SharePoint with F#
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
 
PowerShell and SharePoint @spsnyc July 2012
Talbott Crowell
 
PowerShell and SharePoint
Talbott Crowell
 
Welcome to windows 8
Talbott Crowell
 
Exploring SharePoint with F#
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
 

Automating PowerShell with SharePoint

  • 1.PowerShell SharePointTalbott CrowellSPSBoston, September 25, 2010http://www.thirdm.com
  • 2.Unix-like shellObject oriented.NETCommand lineScripting languageWhat is PowerShell?
  • 3.Automated build and deployRapid prototypingExploring “What If” scenariosDeveloper onboardingAdministration automationWhy PowerShell for SharePoint?
  • 4.When you want to make your team more agileAutomation, automation, automationWhen developing, your daily build is like the projects heartbeatPowerShell can be the pacemakerTestingUse the PowerShell scripts to stand up an environment for running testsWhen use PowerShell?
  • 5.What do you know about a command line?DIRHow about$a = DIRWhat is $a?.NET Objectuse gm or get-member to query properitesArray$a[0]PowerShell Basics
  • 6.PowerShell Basics$a = DIR$a | gmDatesDemo - Basics
  • 7.Cmd, notepadPowerShell CommandWindows PowerShell Integrated Scripting Environment (ISE)Import-Module ServerManager;Add-WindowsFeaturePowerShell-ISE PowerGUIDownload from powergui.orgTools
  • 8.# for commentVerb-Noun convention for commandletsWrite-Host “Hello World”Set-ExecutionPolicyUnrestricted.\scriptname to executeMore Basics
  • 9.Comes with PowerShell CommandletsGet-SPSiteNew-SPSiteNew-SPWebIf you are running from standard PowerShellAdd-PSSnapinmicrosoft.sharepoint.powershell-ErrorActionSilentlyContinueSharePoint 2010
  • 10.Get-SPSiteParameter: urlNew-SPSiteParameters: url, name, ownerAlias, templateNew-SPWebParameters: url, name, description, template…Other params: -AddToTopNav or -UseParentTopNav-AddToQuickLaunchCreate Site Collections and Sites
  • 11.Your friend STSADM is still thereYou can call STSADM or any command line tool from PowerShellYou can write your own command line tools with .NETBetter yet, you can write your own PowerShell Commandlets!Inherit from Cmdletor PSCmdletGary Lapointe has WSS and MOSS Cmdlets!http://stsadm.blogspot.com/2009/02/downloads.htmlWhat about MOSS 2007 or WSS?
  • 12.When creating non-persistent tasks (i.e. get info) use:SPCmdletWhen objects persist between commands, use:SPRemoveCmdletBaseSPNewCmdletBaseSPSetCmdletBaseSPGetCmdletBaseFor more info, see Gary Lapointe’s blog post:http://stsadm.blogspot.com/2009/10/creating-custom-sharepoint-2010-cmdlets.htmlCreating SharePoint 2010 Cmdlets
  • 13.[void][System.Reflection.Assembly]::LoadWithPartialName(”Microsoft.SharePoint”)Load the assembly$SPSite = New-ObjectMicrosoft.SharePoint.SPSite($url)Reference to the site collection using SharePoint object modelDon’t forget to$SPSite.Dispose()Creating SharePoint Objects
  • 14.Series of scripts to build your siteCleanup script to destroy siteEdit script, run cleanup, run script, view siteRepeatStrategy
  • 15.Build2010.ps1Calls other scriptsBuild2010_site_structure.ps1Sets up the basic site structure and content typesBuild2010_upload_file.ps1Uploads sample files to the siteBuild2010_set_logo.ps1Adds site logoBuild2010_add_users.ps1Adds users to local machine and/or SharePoint groupsDemo – series of scripts
  • 16.function Get-Theme([Microsoft.SharePoint.SPWeb]$SPWeb,[string]$themeName)Strong typed parametersReturns Microsoft.SharePoint.Utilities.ThmxThemeDefining functions
  • 17.Upload FileTakes in 1 or more filesHas 3 blocksBeginProcessEndProcess is executed for each filegci 'C:\uploadfiles\Samples\Legal' | .\build2010_upload_file.ps1 -Location "shared/legal" -DocLib "Documents" -ContentType "Document" -MetaDataField "Dept" -MetaDataValue "Legal"Iteration Style Scripts
  • 18.How to: Build a SharePoint 2010 PowerShell Cmdlethttp://silverlight.sys-con.com/node/1370916Other References
  • 19.Thank you. Questions?PowerShell SharePointTalbott CrowellThirdM.comhttp://talbottc.spaces.live.comTwitter: @talbott

[8]ページ先頭

©2009-2025 Movatter.jp