SlideShare a Scribd company logo
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

More Related Content

PPTX
Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT
PDF
Puppeteer - Headless Chrome Node API
PDF
SEP DevOps Ignite Talk - Packer
PDF
F5 Automation and service discovery
PDF
DevOps - Infrastructure as Code by Andre Marcelo-Tanner
PDF
macos installation automation
PDF
Docker slides
PDF
Case study: JBoss Developer Studio, an IDE for Web, Mobile and Cloud applicat...
Windows Azure Web Sites - Things they don’t teach kids in school - BuildStuffLT
Puppeteer - Headless Chrome Node API
SEP DevOps Ignite Talk - Packer
F5 Automation and service discovery
DevOps - Infrastructure as Code by Andre Marcelo-Tanner
macos installation automation
Docker slides
Case study: JBoss Developer Studio, an IDE for Web, Mobile and Cloud applicat...

What's hot (20)

PDF
10 things every developer should know about their database to run word press ...
PDF
Firebase slide
PPTX
Cyansible
PDF
Ruby on Rails Kickstart 101 & 102
ODP
Drupal7
PDF
Ansible testing
PPTX
Troubleshooting Apache CloudStack at #ccceu14 by @jorizvl
PDF
Cialug August 2021
PPTX
Package Management on Windows with Chocolatey
PDF
What makes me "Grunt"?
PPTX
Setting up Kubernetes with tectonic
PDF
Ansible and AWS
PDF
빈스톡 첫인상 with Git
PPTX
Ansible: How to Get More Sleep and Require Less Coffee
PDF
Tips and Tricks for Automating Windows with Chef
PDF
Deploying PHP Applications with Ansible
PDF
Node intro
PDF
Testing Ansible with Jenkins and Docker
PDF
Docker in Production - IPC 15 München
PPTX
Basics of Ansible - Sahil Davawala
10 things every developer should know about their database to run word press ...
Firebase slide
Cyansible
Ruby on Rails Kickstart 101 & 102
Drupal7
Ansible testing
Troubleshooting Apache CloudStack at #ccceu14 by @jorizvl
Cialug August 2021
Package Management on Windows with Chocolatey
What makes me "Grunt"?
Setting up Kubernetes with tectonic
Ansible and AWS
빈스톡 첫인상 with Git
Ansible: How to Get More Sleep and Require Less Coffee
Tips and Tricks for Automating Windows with Chef
Deploying PHP Applications with Ansible
Node intro
Testing Ansible with Jenkins and Docker
Docker in Production - IPC 15 München
Basics of Ansible - Sahil Davawala
Ad

Viewers also liked (7)

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

Similar to Automating PowerShell with SharePoint (20)

PPTX
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
PPTX
Intro to SharePoint + PowerShell
PPTX
NZ Code Camp 2011 PowerShell + SharePoint
PPTX
Introduction to PowerShell for SharePoint Admins and Developers - SharePoint ...
PPTX
Intro to PowerShell
PPTX
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
PPTX
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
PPTX
Power shell for sp admins
PPTX
PowerShell Fundamentals for SharePoint
PPTX
Using PowerShell for SharePoint 2013
PDF
Operacion Guinda 2
PPTX
Introduction to PowerShell for SharePoint Admins and Developers
PPTX
Using Powershell to manage SharePoint
PDF
PowerShell for SharePoint Developers
PDF
Introduction to PowerShell
PPTX
Introduction to windows power shell in sharepoint 2010
PPTX
Automating Your Enterprise Application Deployments With PowerShell by Geoff V...
PPTX
Power shell basics in sharepoint 2010 - SharePoint Saturday Houston 2010
PPTX
How to do everything with PowerShell
PPTX
PowerShell Basics for Office Apps and Servers
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Intro to SharePoint + PowerShell
NZ Code Camp 2011 PowerShell + SharePoint
Introduction to PowerShell for SharePoint Admins and Developers - SharePoint ...
Intro to PowerShell
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
Power shell for sp admins
PowerShell Fundamentals for SharePoint
Using PowerShell for SharePoint 2013
Operacion Guinda 2
Introduction to PowerShell for SharePoint Admins and Developers
Using Powershell to manage SharePoint
PowerShell for SharePoint Developers
Introduction to PowerShell
Introduction to windows power shell in sharepoint 2010
Automating Your Enterprise Application Deployments With PowerShell by Geoff V...
Power shell basics in sharepoint 2010 - SharePoint Saturday Houston 2010
How to do everything with PowerShell
PowerShell Basics for Office Apps and Servers

More from Talbott Crowell (19)

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

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