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

More Related Content

PDF
How to import wordpress blog to your self hosted wordpress site
PDF
Fix price fix scope fix date-pecha_kuchas-journeeagile2014
PPTX
Custom Development for SharePoint
PPTX
Top 3 Mistakes when Building
PPT
Automating SQL Server Database Creation for SharePoint
PPTX
Cloud-Based App Development using SharePoint 2013, Office 365 and Azure
PPTX
Road to the Cloud - Extending your reach with SharePoint and Office 365
PPTX
Building high performance and scalable share point applications
How to import wordpress blog to your self hosted wordpress site
Fix price fix scope fix date-pecha_kuchas-journeeagile2014
Custom Development for SharePoint
Top 3 Mistakes when Building
Automating SQL Server Database Creation for SharePoint
Cloud-Based App Development using SharePoint 2013, Office 365 and Azure
Road to the Cloud - Extending your reach with SharePoint and Office 365
Building high performance and scalable share point applications

Similar to PowerShell and SharePoint @spsnyc July 2012 (20)

PPTX
PowerShell and SharePoint
PPTX
Automating PowerShell with SharePoint
PDF
Operacion Guinda 2
PPTX
Spsatx slides (widescreen)
PPTX
How to do everything with PowerShell
PPTX
Using Powershell to manage SharePoint
PPTX
5/12/10 Inaugural Boston Area SharePoint Users Group Meeting
PPTX
Power shell for sp admins
PPTX
Intro to PowerShell
PPTX
SPSTC - PowerShell - Through the SharePoint Looking Glass
PDF
Introduction to PowerShell
PPTX
PowerShell for developers
PPTX
PowerShell Basics for Office Apps and Servers
PPTX
Intro to SharePoint + PowerShell
PPTX
Making Life Easier with PowerShell - SPSRIC
PPTX
Managing SharePoint Anywhere with Windows PowerShell
PPTX
Using PowerShell for SharePoint 2013
PPTX
SUGUK Let me script that for you
PPTX
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
PPTX
Making Life Easier with PowerShell (SPSVB 2012)
PowerShell and SharePoint
Automating PowerShell with SharePoint
Operacion Guinda 2
Spsatx slides (widescreen)
How to do everything with PowerShell
Using Powershell to manage SharePoint
5/12/10 Inaugural Boston Area SharePoint Users Group Meeting
Power shell for sp admins
Intro to PowerShell
SPSTC - PowerShell - Through the SharePoint Looking Glass
Introduction to PowerShell
PowerShell for developers
PowerShell Basics for Office Apps and Servers
Intro to SharePoint + PowerShell
Making Life Easier with PowerShell - SPSRIC
Managing SharePoint Anywhere with Windows PowerShell
Using PowerShell for SharePoint 2013
SUGUK Let me script that for you
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Making Life Easier with PowerShell (SPSVB 2012)
Ad

More from Talbott Crowell (12)

PPTX
Talbott's brief History of Computers for CollabDays Hamburg 2025
PPTX
Top 7 mistakes
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
Welcome to windows 8
PPTX
Exploring SharePoint with F#
PPTX
F# And Silverlight
PPTX
SharePoint Saturday Boston 2010
PPTX
Introduction to F#
PPTX
Architecting Solutions for the Manycore Future
Talbott's brief History of Computers for CollabDays Hamburg 2025
Top 7 mistakes
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
Welcome to windows 8
Exploring SharePoint with F#
F# And Silverlight
SharePoint Saturday Boston 2010
Introduction to F#
Architecting Solutions for the Manycore Future
Ad

Recently uploaded (20)

PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Empathic Computing: Creating Shared Understanding
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Approach and Philosophy of On baking technology
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Electronic commerce courselecture one. Pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPT
Teaching material agriculture food technology
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Cloud computing and distributed systems.
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Encapsulation_ Review paper, used for researhc scholars
Unlocking AI with Model Context Protocol (MCP)
Empathic Computing: Creating Shared Understanding
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Approach and Philosophy of On baking technology
Understanding_Digital_Forensics_Presentation.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Electronic commerce courselecture one. Pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
MIND Revenue Release Quarter 2 2025 Press Release
Teaching material agriculture food technology
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Digital-Transformation-Roadmap-for-Companies.pptx
The AUB Centre for AI in Media Proposal.docx
20250228 LYD VKU AI Blended-Learning.pptx
Cloud computing and distributed systems.
Reach Out and Touch Someone: Haptics and Empathic Computing

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