SlideShare a Scribd company logo
1 of 29
MAKING LIFE EASIER
WITH POWERSHELL




    January 7, 2012
AGENDA

           •   What is PowerShell
           •   Working with PowerShell
           •   When to Use PowerShell
           •   Top 10 SharePoint 2010 Cmdlets
           •   Using the PowerShell Pipeline
           •   User Scenarios
           •   Tools & Resources




1/7/2012                  Making Life Easier with PowerShell   3
Core Concepts

           WHAT IS POWERSHELL


1/7/2012                   Making Life Easier with PowerShell   4
WHAT IS POWERSHELL

           •   Microsoft task automation framework built on the .NET framework
                • Command-line shell
                • Scripting language (*.ps1)
           •   Common “shell” to Microsoft technologies (AD, SQL, SP, Server, etc.)
           •   Full access to COM (Component Object Model) and WMI (Windows
               Management Instrumentation) for local and remote system
               management
           •   Replacement to STSADM (deprecated)
           •   PowerShell > STSADM
                • All STSADM operations have a PowerShell equivalent
                • Integrated support for multiple platforms/services (not SP specific)
                • Easily Extendable


1/7/2012                   Making Life Easier with PowerShell   5
Core Concepts

           WORKING WITH POWERSHELL


1/7/2012                   Making Life Easier with PowerShell   6
POWERSHELL SNAP-INS

           •   PowerShell snap-in registers sets of cmdlets and/or providers,
               extending the default functionality of the shell
           •   Similar to a web browser plug-in
           •   Added and removed as needed during user session




1/7/2012                  Making Life Easier with PowerShell   7
POWERSHELL CMDLETS

           •   A cmdlet (“command-let”) is a specific command executed in the
               PowerShell environment
           •   Following a common {verb}-{noun} naming convention, cmdlet
               functions are typically easily understood, ie: Add-PSSnapin, Get-
               SPWeb, etc.
           •   Used like a function, cmdlets take one or more input
               parameters/objects, and output objects or arrays of objects
           •   Cmdlets can be piped together, allowing the output object of one to
               become the input object of another
           •   Objects are always processed individually, if multiple input objects are
               specified, each object will be fully processed before the next is begun




1/7/2012                   Making Life Easier with PowerShell   8
WHEN TO USE POWERSHELL

           •   Making life “easier” with PowerShell should equate to increased
               efficiency, lower cost, and lower turnaround
           •   Identify those processes which are repetitive in nature or those that
               require extended “hands-on” time




1/7/2012                   Making Life Easier with PowerShell   9
GETTING STARTED


           SharePoint 2010
           Management Shell
           PowerShell with the
           SharePoint Snap-in Loaded




1/7/2012                  Making Life Easier with PowerShell   10
STARTING POWERSHELL


           PowerShell 2.0




1/7/2012                    Making Life Easier with PowerShell   11
Demonstration

           CREATE A POWERSHELL PROFILE


1/7/2012                   Making Life Easier with PowerShell   12
SharePoint 2010

           TOP 10 POWERSHELL CMDLETS


1/7/2012                 Making Life Easier with PowerShell   13
GET-HELP

           •   Overview
               • Displays help about Windows PowerShell cmdlets and concepts


           •   Examples
               • Get-Help {cmdlet}
               • Get-Help Test-Path
               • Get-Help Test-Path -Detailed
               • Get-Help Test-Path –Examples
               • Get-Help {topic}
               • Get-Help Snapin




1/7/2012                  Making Life Easier with PowerShell   14
GET-MEMBER

           •   Overview
               • Gets the properties and methods of objects. Specify an object
                 using the InputObject parameter, or pipe an object to Get-Member.


           •   Examples
               • Get-Member –InputObject $object
               • $object | Get-Member




1/7/2012                  Making Life Easier with PowerShell   15
GET-SPFARM

           •   Overview
               • Returns the local SharePoint farm.


           •   Examples
               • Get-SPFarm
               • $farm = Get-SPFarm
                 $farm.Properties




1/7/2012                  Making Life Easier with PowerShell   16
GET-SPWEBAPPLICATION

           •   Overview
               • Returns all web applications that match the given criteria. If no
                 identity is specified, all web applications are returned. The Central
                 Administration web application is ignored unless specified directly
                 or the IncludeCentralAdministration flag is specified.


           •   Examples
               • Get-SPWebApplication
               • Get-SPWebApplication –IncludeCentralAdministration
               • Get-SPWebApplication http://intranet




1/7/2012                  Making Life Easier with PowerShell   17
GET-SPSITE

           •   Overview
               • Returns all the site collections that match the given criteria. If no
                 identity is specified, the farm is scope is used.


           •   Examples
               • Get-SPSite
               • Get-SPSite http://intranet
               • Get-SPSite http://intranet/depts/facilities




1/7/2012                  Making Life Easier with PowerShell   18
GET-SPWEB

           •   Overview
               • Returns all subsites that match the given criteria.


           •   Examples
               • Get-SPWeb http://intranet/depts/HR/benefits
               • Get-SPWeb http://intranet/depts/HR/*
               • Get-SPWeb http://intranet/* –filter {$_.Template –eq “STS#0”}




1/7/2012                  Making Life Easier with PowerShell   19
GET-SPSERVICEAPPLICATION

           •   Overview
               • Returns the specified service application. If no service application
                 is specified, all are returned.


           •   Examples
               • Get-SPServiceApplication
               • Get-SPServiceApplication | select Name, Status




1/7/2012                  Making Life Easier with PowerShell   20
GET-SPCONTENTDATABASE

           •   Overview
               • Returns one or more content databases.


           •   Examples
               • Get-SPContentDatabase
               • Get-SPContentDatabase –WebApplication http://intranet
               • Get-SPContentDatabase –Site http://intranet




1/7/2012                  Making Life Easier with PowerShell   21
TEST-SPCONTENTDATABASE

           •   Overview
               • Tests a content database against a web application to verify all
                 customizations referenced within the content database are also
                 installed in the web application. Content databases do not need to
                 be mounted for validation to complete.


           •   Examples
               • Test-SPContentDatabase –name Lab_Content_Intranet
                      –WebApplication http://intranet




1/7/2012                  Making Life Easier with PowerShell   22
EXPORT-CLIXML & EXPORT-CSV

           •   Overview                                        •   Overview
               • Creates an XML-based                              • Converts objects into a
                 representation of an                                series of comma-
                 object or objects & stores                          separated value strings &
                 in a file.                                          saves file.


           •   Examples                                        •   Examples
               • $sites = Get-SPSite                               • $sites = Get-SPSite
                 Export-Clixml -InputObject                          Export-CSV -InputObject
                     $sites -Path                                        $sites -Path
                 c:sites.xml                                        c:sites.csv
               • Get-SPSite | Export-Clixml                        • Get-SPSite | Export-CSV
                   c:sites.xml                                        c:sites.csvs



1/7/2012                  Making Life Easier with PowerShell           23
Demonstration

           LIST ALL SHAREPOINT CMDLETS


1/7/2012                   Making Life Easier with PowerShell   24
POWERSHELL PIPELINE

           •   The use of the PowerShell Pipeline allows the output object of one cmdlet
               to become the input object of another
           •   “Piping” is performed by using the pipe character “ | ” between cmdlets
           •   Applies to native cmdlets (such as sorting, logical operations, and data
               manipulation) and functional cmdlets (such as those for SharePoint)

                • Logical Example:
                   Get-SPContentDatabase -WebApplication http://intranet | Where
                   {$_.CurrentSiteCount -gt 5}

                • Functional Example:
                   Get-SPSite http://intranet | Get-SPWeb | Enable-SPFeature -Identity
                   “MyFeature”




1/7/2012                   Making Life Easier with PowerShell   25
Demonstration

           USER SCENARIOS


1/7/2012                   Making Life Easier with PowerShell   26
TOOLS & RESOURCES
           •   Tools
                •   Windows PowerShell Integrated Scripting Environment (ISE)
                •   Idera PowerShell Plus (free trial available)
           •   Resources
                •   STSADM -> PowerShell Mapping
                    http://technet.microsoft.com/en-us/library/ff621081.aspx
                •   Scripting with Windows PowerShell (5 part webcast series)
                    http://technet.microsoft.com/en-us/scriptcenter/dd742419
                •   PowerShell Power Hour (monthly lunchtime webcasts)
                    http://idera.com/Education/PowerShell-Webcasts/
                •   SP2010 Visual PowerShell Command Builder
                    http://www.microsoft.com/resources/TechNet/en-
                    us/Office/media/WindowsPowerShell/WindowsPowerShellCommandBuilder.ht
                    ml
                •   Automating Microsoft SharePoint 2010 Administration with Windows
                    PowerShell 2.0. Gary Lapointe, Shannon Bray
                •   Automating Microsoft Windows Server 2008 R2 Administration with Windows
                    PowerShell 2.0. Matthew Hester, Sarah Dutkiewicz



1/7/2012                      Making Life Easier with PowerShell      27
QUESTIONS?
MICHAEL GREENE


@webdes03   mike-greene.com

More Related Content

What's hot

Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO Devs
WO Community
 
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Lucidworks
 
Rise of the Single Page Application
Rise of the Single Page ApplicationRise of the Single Page Application
Rise of the Single Page Application
Piyush Katariya
 
RESTful Api practices Rails 3
RESTful Api practices Rails 3RESTful Api practices Rails 3
RESTful Api practices Rails 3
Anton Narusberg
 
One Drupal to rule them all - Drupalcamp London
One Drupal to rule them all - Drupalcamp LondonOne Drupal to rule them all - Drupalcamp London
One Drupal to rule them all - Drupalcamp London
hernanibf
 

What's hot (20)

Building a SharePoint Platform That Scales
Building a SharePoint Platform That ScalesBuilding a SharePoint Platform That Scales
Building a SharePoint Platform That Scales
 
Alfresco Content Modelling and Policy Behaviours
Alfresco Content Modelling and Policy BehavioursAlfresco Content Modelling and Policy Behaviours
Alfresco Content Modelling and Policy Behaviours
 
Html5v1
Html5v1Html5v1
Html5v1
 
Oozie at Yahoo
Oozie at YahooOozie at Yahoo
Oozie at Yahoo
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO Devs
 
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
 
SE2016 - Java EE revisits design patterns 2016
SE2016 - Java EE revisits design patterns 2016SE2016 - Java EE revisits design patterns 2016
SE2016 - Java EE revisits design patterns 2016
 
Rise of the Single Page Application
Rise of the Single Page ApplicationRise of the Single Page Application
Rise of the Single Page Application
 
[DanNotes] XPages - Beyound the Basics
[DanNotes] XPages - Beyound the Basics[DanNotes] XPages - Beyound the Basics
[DanNotes] XPages - Beyound the Basics
 
Oozie towards zero downtime
Oozie towards zero downtimeOozie towards zero downtime
Oozie towards zero downtime
 
Data Pipeline Management Framework on Oozie
Data Pipeline Management Framework on OozieData Pipeline Management Framework on Oozie
Data Pipeline Management Framework on Oozie
 
MWLUG 2015 - AD114 Take Your XPages Development to the Next Level
MWLUG 2015 - AD114 Take Your XPages Development to the Next LevelMWLUG 2015 - AD114 Take Your XPages Development to the Next Level
MWLUG 2015 - AD114 Take Your XPages Development to the Next Level
 
The Solar Framework for PHP 5 (2010 Confoo)
The Solar Framework for PHP 5 (2010 Confoo)The Solar Framework for PHP 5 (2010 Confoo)
The Solar Framework for PHP 5 (2010 Confoo)
 
JSP Part 2
JSP Part 2JSP Part 2
JSP Part 2
 
Access Data from XPages with the Relational Controls
Access Data from XPages with the Relational ControlsAccess Data from XPages with the Relational Controls
Access Data from XPages with the Relational Controls
 
Organinzing Your PHP Projects (2010 Memphis PHP)
Organinzing Your PHP Projects (2010 Memphis PHP)Organinzing Your PHP Projects (2010 Memphis PHP)
Organinzing Your PHP Projects (2010 Memphis PHP)
 
Plone pas.plugins.ldap user/group search
Plone pas.plugins.ldap user/group searchPlone pas.plugins.ldap user/group search
Plone pas.plugins.ldap user/group search
 
RESTful Api practices Rails 3
RESTful Api practices Rails 3RESTful Api practices Rails 3
RESTful Api practices Rails 3
 
One Drupal to rule them all - Drupalcamp London
One Drupal to rule them all - Drupalcamp LondonOne Drupal to rule them all - Drupalcamp London
One Drupal to rule them all - Drupalcamp London
 
Crx 2.2 Deep-Dive
Crx 2.2 Deep-DiveCrx 2.2 Deep-Dive
Crx 2.2 Deep-Dive
 

Similar to Making Life Easier with PowerShell (SPSVB 2012)

PowerShellForDBDevelopers
PowerShellForDBDevelopersPowerShellForDBDevelopers
PowerShellForDBDevelopers
Bryan Cafferky
 
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvpZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
Chalermpon Areepong
 
Power shell for sp admins
Power shell for sp adminsPower shell for sp admins
Power shell for sp admins
Rick Taylor
 
PowerShell for SharePoint Admins
PowerShell for SharePoint AdminsPowerShell for SharePoint Admins
PowerShell for SharePoint Admins
Rick Taylor
 
PowerShell for the Anxious ITPro
PowerShell for the Anxious ITProPowerShell for the Anxious ITPro
PowerShell for the Anxious ITPro
Jason Himmelstein
 
API-Testing-SOAPUI-1.pptx
API-Testing-SOAPUI-1.pptxAPI-Testing-SOAPUI-1.pptx
API-Testing-SOAPUI-1.pptx
amarnathdeo
 
Developing Portlets
Developing PortletsDeveloping Portlets
Developing Portlets
sydeburn
 

Similar to Making Life Easier with PowerShell (SPSVB 2012) (20)

Spsatx slides (widescreen)
Spsatx slides (widescreen)Spsatx slides (widescreen)
Spsatx slides (widescreen)
 
PowerShellForDBDevelopers
PowerShellForDBDevelopersPowerShellForDBDevelopers
PowerShellForDBDevelopers
 
Intro to SharePoint + PowerShell
Intro to SharePoint + PowerShellIntro to SharePoint + PowerShell
Intro to SharePoint + PowerShell
 
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvpZZ BC#7 asp.net mvc practice and guideline by NineMvp
ZZ BC#7 asp.net mvc practice and guideline by NineMvp
 
PowerShell Introduction to Administering SharePoint On-Premises & O365
PowerShell Introduction to Administering SharePoint On-Premises & O365PowerShell Introduction to Administering SharePoint On-Premises & O365
PowerShell Introduction to Administering SharePoint On-Premises & O365
 
Power shell for sp admins
Power shell for sp adminsPower shell for sp admins
Power shell for sp admins
 
Supercharge PBCS with PowerShell
Supercharge PBCS with PowerShellSupercharge PBCS with PowerShell
Supercharge PBCS with PowerShell
 
ZZ BC#7.5 asp.net mvc practice and guideline refresh!
ZZ BC#7.5 asp.net mvc practice  and guideline refresh! ZZ BC#7.5 asp.net mvc practice  and guideline refresh!
ZZ BC#7.5 asp.net mvc practice and guideline refresh!
 
PowerShell for SharePoint Admins
PowerShell for SharePoint AdminsPowerShell for SharePoint Admins
PowerShell for SharePoint Admins
 
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshopIntroduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
 
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...
Developing Kafka Streams Applications with Upgradability in Mind with Neil Bu...
 
PowerShell for the Anxious ITPro
PowerShell for the Anxious ITProPowerShell for the Anxious ITPro
PowerShell for the Anxious ITPro
 
Plantilla oracle
Plantilla oraclePlantilla oracle
Plantilla oracle
 
Build Your First SharePoint Framework Webpart
Build Your First SharePoint Framework WebpartBuild Your First SharePoint Framework Webpart
Build Your First SharePoint Framework Webpart
 
Build Automation of PHP Applications
Build Automation of PHP ApplicationsBuild Automation of PHP Applications
Build Automation of PHP Applications
 
API-Testing-SOAPUI-1.pptx
API-Testing-SOAPUI-1.pptxAPI-Testing-SOAPUI-1.pptx
API-Testing-SOAPUI-1.pptx
 
Introduction to SoapUI day 1
Introduction to SoapUI day 1Introduction to SoapUI day 1
Introduction to SoapUI day 1
 
Soap UI - Getting started
Soap UI - Getting startedSoap UI - Getting started
Soap UI - Getting started
 
PowerShell for Penetration Testers
PowerShell for Penetration TestersPowerShell for Penetration Testers
PowerShell for Penetration Testers
 
Developing Portlets
Developing PortletsDeveloping Portlets
Developing Portlets
 

More from Michael Greene

ATLSPUG - SharePoint Branding Best Bets
ATLSPUG - SharePoint Branding Best BetsATLSPUG - SharePoint Branding Best Bets
ATLSPUG - SharePoint Branding Best Bets
Michael Greene
 
SharePoint Branding Best Bets (SharePoint Saturday Richmond, 2013)
SharePoint Branding Best Bets (SharePoint Saturday Richmond, 2013)SharePoint Branding Best Bets (SharePoint Saturday Richmond, 2013)
SharePoint Branding Best Bets (SharePoint Saturday Richmond, 2013)
Michael Greene
 
SharePoint Saturday Tampa, Enhancing SharePoint 2010 for the iPad
SharePoint Saturday Tampa, Enhancing SharePoint 2010 for the iPadSharePoint Saturday Tampa, Enhancing SharePoint 2010 for the iPad
SharePoint Saturday Tampa, Enhancing SharePoint 2010 for the iPad
Michael Greene
 

More from Michael Greene (11)

Anatomy of an Intranet (Triangle SharePoint User Group) January 2016
Anatomy of an Intranet (Triangle SharePoint User Group) January 2016Anatomy of an Intranet (Triangle SharePoint User Group) January 2016
Anatomy of an Intranet (Triangle SharePoint User Group) January 2016
 
Anatomy of an Intranet (Triangle SharePoint User Group) October 2016
Anatomy of an Intranet (Triangle SharePoint User Group) October 2016Anatomy of an Intranet (Triangle SharePoint User Group) October 2016
Anatomy of an Intranet (Triangle SharePoint User Group) October 2016
 
Anatomy of an Intranet (SPSATL 2014)
Anatomy of an Intranet (SPSATL 2014)Anatomy of an Intranet (SPSATL 2014)
Anatomy of an Intranet (SPSATL 2014)
 
Enhancing SharePoint 2010 for the iPad (Richmond SPUG 10/31/2012)
Enhancing SharePoint 2010 for the iPad (Richmond SPUG 10/31/2012)Enhancing SharePoint 2010 for the iPad (Richmond SPUG 10/31/2012)
Enhancing SharePoint 2010 for the iPad (Richmond SPUG 10/31/2012)
 
ATLSPUG - SharePoint Branding Best Bets
ATLSPUG - SharePoint Branding Best BetsATLSPUG - SharePoint Branding Best Bets
ATLSPUG - SharePoint Branding Best Bets
 
SharePoint Branding Best Bets (SharePoint Saturday Richmond, 2013)
SharePoint Branding Best Bets (SharePoint Saturday Richmond, 2013)SharePoint Branding Best Bets (SharePoint Saturday Richmond, 2013)
SharePoint Branding Best Bets (SharePoint Saturday Richmond, 2013)
 
Making Life Easier with PowerShell (SPSATL 2012)
Making Life Easier with PowerShell (SPSATL 2012)Making Life Easier with PowerShell (SPSATL 2012)
Making Life Easier with PowerShell (SPSATL 2012)
 
Enhancing SharePoint 2010 for the iPad (SPSAusTX 2012)
Enhancing SharePoint 2010 for the iPad (SPSAusTX 2012)Enhancing SharePoint 2010 for the iPad (SPSAusTX 2012)
Enhancing SharePoint 2010 for the iPad (SPSAusTX 2012)
 
Enhancing SharePoint 2010 for the iPad (SPSVB 2012)
Enhancing SharePoint 2010 for the iPad (SPSVB 2012)Enhancing SharePoint 2010 for the iPad (SPSVB 2012)
Enhancing SharePoint 2010 for the iPad (SPSVB 2012)
 
SharePoint Saturday Tampa, Enhancing SharePoint 2010 for the iPad
SharePoint Saturday Tampa, Enhancing SharePoint 2010 for the iPadSharePoint Saturday Tampa, Enhancing SharePoint 2010 for the iPad
SharePoint Saturday Tampa, Enhancing SharePoint 2010 for the iPad
 
Enhancing SharePoint 2010 for the iPad
Enhancing SharePoint 2010 for the iPadEnhancing SharePoint 2010 for the iPad
Enhancing SharePoint 2010 for the iPad
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Making Life Easier with PowerShell (SPSVB 2012)

  • 1. MAKING LIFE EASIER WITH POWERSHELL January 7, 2012
  • 2.
  • 3. AGENDA • What is PowerShell • Working with PowerShell • When to Use PowerShell • Top 10 SharePoint 2010 Cmdlets • Using the PowerShell Pipeline • User Scenarios • Tools & Resources 1/7/2012 Making Life Easier with PowerShell 3
  • 4. Core Concepts WHAT IS POWERSHELL 1/7/2012 Making Life Easier with PowerShell 4
  • 5. WHAT IS POWERSHELL • Microsoft task automation framework built on the .NET framework • Command-line shell • Scripting language (*.ps1) • Common “shell” to Microsoft technologies (AD, SQL, SP, Server, etc.) • Full access to COM (Component Object Model) and WMI (Windows Management Instrumentation) for local and remote system management • Replacement to STSADM (deprecated) • PowerShell > STSADM • All STSADM operations have a PowerShell equivalent • Integrated support for multiple platforms/services (not SP specific) • Easily Extendable 1/7/2012 Making Life Easier with PowerShell 5
  • 6. Core Concepts WORKING WITH POWERSHELL 1/7/2012 Making Life Easier with PowerShell 6
  • 7. POWERSHELL SNAP-INS • PowerShell snap-in registers sets of cmdlets and/or providers, extending the default functionality of the shell • Similar to a web browser plug-in • Added and removed as needed during user session 1/7/2012 Making Life Easier with PowerShell 7
  • 8. POWERSHELL CMDLETS • A cmdlet (“command-let”) is a specific command executed in the PowerShell environment • Following a common {verb}-{noun} naming convention, cmdlet functions are typically easily understood, ie: Add-PSSnapin, Get- SPWeb, etc. • Used like a function, cmdlets take one or more input parameters/objects, and output objects or arrays of objects • Cmdlets can be piped together, allowing the output object of one to become the input object of another • Objects are always processed individually, if multiple input objects are specified, each object will be fully processed before the next is begun 1/7/2012 Making Life Easier with PowerShell 8
  • 9. WHEN TO USE POWERSHELL • Making life “easier” with PowerShell should equate to increased efficiency, lower cost, and lower turnaround • Identify those processes which are repetitive in nature or those that require extended “hands-on” time 1/7/2012 Making Life Easier with PowerShell 9
  • 10. GETTING STARTED SharePoint 2010 Management Shell PowerShell with the SharePoint Snap-in Loaded 1/7/2012 Making Life Easier with PowerShell 10
  • 11. STARTING POWERSHELL PowerShell 2.0 1/7/2012 Making Life Easier with PowerShell 11
  • 12. Demonstration CREATE A POWERSHELL PROFILE 1/7/2012 Making Life Easier with PowerShell 12
  • 13. SharePoint 2010 TOP 10 POWERSHELL CMDLETS 1/7/2012 Making Life Easier with PowerShell 13
  • 14. GET-HELP • Overview • Displays help about Windows PowerShell cmdlets and concepts • Examples • Get-Help {cmdlet} • Get-Help Test-Path • Get-Help Test-Path -Detailed • Get-Help Test-Path –Examples • Get-Help {topic} • Get-Help Snapin 1/7/2012 Making Life Easier with PowerShell 14
  • 15. GET-MEMBER • Overview • Gets the properties and methods of objects. Specify an object using the InputObject parameter, or pipe an object to Get-Member. • Examples • Get-Member –InputObject $object • $object | Get-Member 1/7/2012 Making Life Easier with PowerShell 15
  • 16. GET-SPFARM • Overview • Returns the local SharePoint farm. • Examples • Get-SPFarm • $farm = Get-SPFarm $farm.Properties 1/7/2012 Making Life Easier with PowerShell 16
  • 17. GET-SPWEBAPPLICATION • Overview • Returns all web applications that match the given criteria. If no identity is specified, all web applications are returned. The Central Administration web application is ignored unless specified directly or the IncludeCentralAdministration flag is specified. • Examples • Get-SPWebApplication • Get-SPWebApplication –IncludeCentralAdministration • Get-SPWebApplication http://intranet 1/7/2012 Making Life Easier with PowerShell 17
  • 18. GET-SPSITE • Overview • Returns all the site collections that match the given criteria. If no identity is specified, the farm is scope is used. • Examples • Get-SPSite • Get-SPSite http://intranet • Get-SPSite http://intranet/depts/facilities 1/7/2012 Making Life Easier with PowerShell 18
  • 19. GET-SPWEB • Overview • Returns all subsites that match the given criteria. • Examples • Get-SPWeb http://intranet/depts/HR/benefits • Get-SPWeb http://intranet/depts/HR/* • Get-SPWeb http://intranet/* –filter {$_.Template –eq “STS#0”} 1/7/2012 Making Life Easier with PowerShell 19
  • 20. GET-SPSERVICEAPPLICATION • Overview • Returns the specified service application. If no service application is specified, all are returned. • Examples • Get-SPServiceApplication • Get-SPServiceApplication | select Name, Status 1/7/2012 Making Life Easier with PowerShell 20
  • 21. GET-SPCONTENTDATABASE • Overview • Returns one or more content databases. • Examples • Get-SPContentDatabase • Get-SPContentDatabase –WebApplication http://intranet • Get-SPContentDatabase –Site http://intranet 1/7/2012 Making Life Easier with PowerShell 21
  • 22. TEST-SPCONTENTDATABASE • Overview • Tests a content database against a web application to verify all customizations referenced within the content database are also installed in the web application. Content databases do not need to be mounted for validation to complete. • Examples • Test-SPContentDatabase –name Lab_Content_Intranet –WebApplication http://intranet 1/7/2012 Making Life Easier with PowerShell 22
  • 23. EXPORT-CLIXML & EXPORT-CSV • Overview • Overview • Creates an XML-based • Converts objects into a representation of an series of comma- object or objects & stores separated value strings & in a file. saves file. • Examples • Examples • $sites = Get-SPSite • $sites = Get-SPSite Export-Clixml -InputObject Export-CSV -InputObject $sites -Path $sites -Path c:sites.xml c:sites.csv • Get-SPSite | Export-Clixml • Get-SPSite | Export-CSV c:sites.xml c:sites.csvs 1/7/2012 Making Life Easier with PowerShell 23
  • 24. Demonstration LIST ALL SHAREPOINT CMDLETS 1/7/2012 Making Life Easier with PowerShell 24
  • 25. POWERSHELL PIPELINE • The use of the PowerShell Pipeline allows the output object of one cmdlet to become the input object of another • “Piping” is performed by using the pipe character “ | ” between cmdlets • Applies to native cmdlets (such as sorting, logical operations, and data manipulation) and functional cmdlets (such as those for SharePoint) • Logical Example: Get-SPContentDatabase -WebApplication http://intranet | Where {$_.CurrentSiteCount -gt 5} • Functional Example: Get-SPSite http://intranet | Get-SPWeb | Enable-SPFeature -Identity “MyFeature” 1/7/2012 Making Life Easier with PowerShell 25
  • 26. Demonstration USER SCENARIOS 1/7/2012 Making Life Easier with PowerShell 26
  • 27. TOOLS & RESOURCES • Tools • Windows PowerShell Integrated Scripting Environment (ISE) • Idera PowerShell Plus (free trial available) • Resources • STSADM -> PowerShell Mapping http://technet.microsoft.com/en-us/library/ff621081.aspx • Scripting with Windows PowerShell (5 part webcast series) http://technet.microsoft.com/en-us/scriptcenter/dd742419 • PowerShell Power Hour (monthly lunchtime webcasts) http://idera.com/Education/PowerShell-Webcasts/ • SP2010 Visual PowerShell Command Builder http://www.microsoft.com/resources/TechNet/en- us/Office/media/WindowsPowerShell/WindowsPowerShellCommandBuilder.ht ml • Automating Microsoft SharePoint 2010 Administration with Windows PowerShell 2.0. Gary Lapointe, Shannon Bray • Automating Microsoft Windows Server 2008 R2 Administration with Windows PowerShell 2.0. Matthew Hester, Sarah Dutkiewicz 1/7/2012 Making Life Easier with PowerShell 27
  • 29. MICHAEL GREENE @webdes03 mike-greene.com

Editor's Notes

  1. Test-Path $profileIf result is FALSENew-Item –type file –force $profileNotepad $profile
  2. Get-Command -PSSnapin “Microsoft.SharePoint.Powershell”
  3. Idera, $199 per user