SlideShare a Scribd company logo
SharePoint PowerShell
for the Admin & Developer
A Venn Diagram Experience
#DogFoodCon

Ryan Dennis | Ricardo Wilkins
What we’re barking about
What is PowerShell?
PowerShell and SharePoint – the evolution
Scripts vs. code – comparison
Business case walk through
Code integration with PowerShell
Architectural discussions

#DogFoodCon
Meet the Mutts
Ryan Dennis

Ricardo Wilkins

Consultant, Blue Chip Consulting Group Consultant, Blue Chip Consulting Group

#DogFoodCon
What’s Your Breed?

#DogFoodCon
What is PowerShell?
…is a task-based command-line shell and
scripting language designed especially for
Windows system administration
…has a task-based scripting language

…includes powerful object manipulation
capabilities
…is built on the .NET Framework
#DogFoodCon
PowerShell deals with Objects,
not Strings
• In order to find out what you can and cannot do or
see on an object, use the Get-Member cmdlet
• Get-Member will return all Methods and Properties
associated with whatever item you pass to it
• PowerShell uses a Verb-Noun syntax for its Cmdlets
• Get-Something
• Set-Something
• New-Something
#DogFoodCon
The Pipeline
• PowerShell passes objects, that is – when you do
something like Get-Process, you’re retrieving process
object(s) – you can then pipe that output, or that
process object to Stop-Process, Select-Object, WhereObject, etc.

• Use the built-in $_ variable to get values from the
current object in the pipeline…
• Let’s talk about this metaphorically… 
#DogFoodCon
The Pipeline

#DogFoodCon
SharePoint 2010 Cmdlets
• 500+ Cmdlets…
• MUCH better than STSADM.exe…

• Can automate complete installations and
configurations…

• Still doesn’t answer every scenario, leaving
gaps in functionality…
• Example: Get, New and Remove SharePoint Groups –
no cmdlet, easy to write a custom function though…
#DogFoodCon
As a Developer, why do I
care?
• Not always necessary to write code
• Use PowerShell to handle things you could
do in C#
• Don’t write console apps, write PowerShell
Scripts!

• Some clients don’t allow managed code
deployments, but PowerShell is A-OK
#DogFoodCon
Managing Solutions & Features
Farm Solutions
•
•
•
•
•

Add-SPSolution
Get-SPSolution
Install-SPSolution
Remove-SPSolution
RemoveSPSolutionDeployme
ntLock
• Uninstall-SPSolution
• Update-SPSolution

#DogFoodCon

Sandboxed Solutions
• Add-SPUserSolution
• Get-SPUserSolution
• InstallSPUserSolution
• RemoveSPUserSolution
• UninstallSPUserSolution
• UpdateSPUserSolution

Features
•
•
•
•
•

Disable-SPFeature
Enable-SPFeature
Get-SPFeature
Install-SPFeature
Uninstall-SPFeature
Retrieving SharePoint Objects
• Multiple ways to get a Site Object using
PowerShell…
• $Site = Get-SPSite
• $Site = New-Object Microsoft.SharePoint.SPSite($Url)

• Multiple ways to get a Web Object using
PowerShell…
• $Web = $Site.RootWeb
• $Web = $Site.OpenWeb()
• $Web = Get-SPWeb
#DogFoodCon
The Evolution of SP Scripting

• About 200 cmds
• Over 500
• Over 700
• No native support
PowerShell cmdlets
PowerShell cmdlets
for PowerShell*
• PowerShell Version • PowerShell Version
• STSADM was it
2.0
3.0

#DogFoodCon
*You could use PowerShell by loading the Microsoft.SharePoint Assembly…
Pros & Cons of Script vs.
Code
Script Pros
Quicker to write
Easier to edit (open a file,
edit it)
No need to install a DLL to
the server
Can access the hundreds
(thousands?) of other
PowerShell cmdlets
(Processes, Services, etc.)
#DogFoodCon

Code Cons
Requires more time to
develop& deploy
Editing requires
redeployment to server
Requires a DLL
installation
C# vs. PowerShell
// register controls
protected TextBox TextBoxMinutesPerSession;
protected LinkButton LinkButtonUpdate;
// Create a click event handler
LinkButtonUpdate.Click
+= new EventHandler(LinkButtonUpdate_Click);
void LinkButtonUpdate_Click(object sender, EventArgs e)
Both code snippets add or set the
{
// Grab the site and web Guid
“CurrentUserSessionDuration”
Guid sitedId = SPContext.Current.Site.ID;
property in a Web.
Guid webID = SPContext.Current.Web.ID;
//create and dispose of spweb and spsite objects
using (SPSite oSPSite = new SPSite(sitedId))
{
using (SPWeb oWeb = oSPSite.OpenWeb(webID))
{
//Set the custom web property to the textbox
value
oWeb.Properties["CurrentUserSessionDuration"]
= TextBoxMinutesPerSession.Text;
oWeb.Properties.Update();
}
$web = Get-SPWeb http://url
}
$web.Properties["CurrentUserSessionDuration"] = "60"
}
$web.Properties.Update()
$web.Dispose()

#DogFoodCon
The Business Case

#DogFoodCon
The Personas
Developer

#DogFoodCon

Admin

Business
Analyst /
Project
Manager
Get-Process –Name “Demo” | Start-Process

#DogFoodCon
Developer + PS
IIS Server
SharePoint
Call
PowerShell
SPList
Log
ListItems

#DogFoodCon

Change
Titles

PS1
SharePoint

-Classic Web Part
-Visual Web Part
-SP2013 App Part

#DogFoodCon
Call
PowerShell

#DogFoodCon
Call
PowerShell

#DogFoodCon

http://ilovesharepoint.codeplex.com/wikipage?title=Execute%20PowerShell%20Script%20Action
-Files reside in e.g. C:Scripts
-Scripts calling scripts as functions
-Storing scripts in source control (TFS)
-BA/PM viewing scripts vs code
#DogFoodCon
SPList
Log
ListItems

function Write-SPAppLogItem {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)][System.String]$WebUrl,
[Parameter(Mandatory=$true)][System.String]$ListName
)
$web = Get-SPWeb $WebUrl
$list = $web.Lists[$ListName]
$item = $list.Items.Add()
$date = Get-Date
$item["Title"] = "Operation completed successfully:
$date"
$item.Update()
$web.Dispose()
}

#DogFoodCon
SPList
Log
ListItems

-BA/PM responsible for this list
-Workflow can kickoff on New Item
-Other apps, or Search, can pull from this list
#DogFoodCon
Why is this worth chewing on?
Separation of Devs vs Ops
Devs maintain the UI
Ops maintains the Title Change process

Separation of Concerns / Single
Responsibility pattern

#DogFoodCon
Other things to chew on?
PS in Office 365
PS in Azure
PS Remoting
PS Workflow

#DogFoodCon
Barks from the Pack
Thoughts?
Would this model work for you?
Other ideas?

#DogFoodCon
>Get-Questions

#DogFoodCon

More Related Content

PPTX
SharePoint Development 101
PPTX
SP24S053 Introduction to PowerShell for SharePoint Developers and Administrators
PDF
PowerShell for SharePoint Developers
PPTX
Managing SharePoint Anywhere with Windows PowerShell
PDF
Crash Course in AngularJS + Ionic (Deep dive)
PPTX
PowerShell for SharePoint Admins
PPTX
PowerShell for sharepoint 2010 administrators
PPTX
Localizing SharePoint: Adding Multi-language Support to Your Site
SharePoint Development 101
SP24S053 Introduction to PowerShell for SharePoint Developers and Administrators
PowerShell for SharePoint Developers
Managing SharePoint Anywhere with Windows PowerShell
Crash Course in AngularJS + Ionic (Deep dive)
PowerShell for SharePoint Admins
PowerShell for sharepoint 2010 administrators
Localizing SharePoint: Adding Multi-language Support to Your Site

What's hot (20)

PPTX
Best Practices in SharePoint Development - Just Freakin Work! Overcoming Hurd...
PPTX
Custom Applications - What, When, and Why
KEY
Features, Exportables & You
PDF
Extending WordPress as a pro
PDF
Behavior Driven Development and Automation Testing Using Cucumber
PDF
In The Trenches With Tomster, Upgrading Ember.js & Ember Data
PDF
O365Con18 - Working with PowerShell, VS Code and GitHub - Thomas Vochten
PPTX
Intro to SharePoint + PowerShell
PPTX
PowerShell Basics for Office Apps and Servers
PDF
A 20 minute introduction to AngularJS for XPage developers
PDF
BDD in Java using Cucumber
PPTX
Integration Testing with Selenium
PPTX
Pantheon basics
PDF
Working in harmony
PDF
Fluxible
PDF
"Design First" APIs with Swagger
KEY
Capybara-Webkit
PDF
Mock Servers - Fake All the Things!
PDF
Behavior Driven Development with Cucumber
PPTX
Hybrid Mobile Development with Apache Cordova and
Best Practices in SharePoint Development - Just Freakin Work! Overcoming Hurd...
Custom Applications - What, When, and Why
Features, Exportables & You
Extending WordPress as a pro
Behavior Driven Development and Automation Testing Using Cucumber
In The Trenches With Tomster, Upgrading Ember.js & Ember Data
O365Con18 - Working with PowerShell, VS Code and GitHub - Thomas Vochten
Intro to SharePoint + PowerShell
PowerShell Basics for Office Apps and Servers
A 20 minute introduction to AngularJS for XPage developers
BDD in Java using Cucumber
Integration Testing with Selenium
Pantheon basics
Working in harmony
Fluxible
"Design First" APIs with Swagger
Capybara-Webkit
Mock Servers - Fake All the Things!
Behavior Driven Development with Cucumber
Hybrid Mobile Development with Apache Cordova and
Ad

Viewers also liked (10)

PPTX
Make a better social collaboration platform with share point 2013
PPTX
Getting Started with SharePoint Development
PPSX
Basics of SharePoint
PPTX
SharePoint Development(Lesson 5)
PDF
Introduction to SharePoint as a Development Platform
PDF
SharePoint 2010 overview
PPTX
What IS SharePoint Development?
PPTX
Designing SharePoint 2010 for Business
PPTX
User Centered Design and SharePoint Publishing Portals
PPTX
Sp administration-training-prism
Make a better social collaboration platform with share point 2013
Getting Started with SharePoint Development
Basics of SharePoint
SharePoint Development(Lesson 5)
Introduction to SharePoint as a Development Platform
SharePoint 2010 overview
What IS SharePoint Development?
Designing SharePoint 2010 for Business
User Centered Design and SharePoint Publishing Portals
Sp administration-training-prism
Ad

Similar to SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience (20)

PPTX
SharePoint Saturday Cincinnati 2014 - CSOM
PPTX
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
PPT
Introduction To Code Igniter
PDF
Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...
PPTX
Build Your First SharePoint Framework Webpart
PPTX
Introducción al SharePoint Framework SPFx
PPTX
How to do everything with PowerShell
PDF
Jenkins CI for MacDevOps
PPTX
WinOps Conf 2016 - Michael Greene - Release Pipelines
PPTX
[Portland 365Sat] PCF Custom Controls
PDF
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
PPTX
O365 Developer Bootcamp NJ 2018 - Material
PPTX
Introduction to Office Development Topics
PPTX
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
PPTX
VMworld 2016: Getting Started with PowerShell and PowerCLI for Your VMware En...
PDF
Behavior & Specification Driven Development in PHP - #OpenWest
PPTX
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
KEY
Dancing with websocket
PPTX
MWLUG 2015 - AD114 Take Your XPages Development to the Next Level
PDF
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
SharePoint Saturday Cincinnati 2014 - CSOM
Introduction to PowerShell - Be a PowerShell Hero - SPFest workshop
Introduction To Code Igniter
Containerisation Hack of a Legacy Software Solution - Alex Carter - CodeMill ...
Build Your First SharePoint Framework Webpart
Introducción al SharePoint Framework SPFx
How to do everything with PowerShell
Jenkins CI for MacDevOps
WinOps Conf 2016 - Michael Greene - Release Pipelines
[Portland 365Sat] PCF Custom Controls
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
O365 Developer Bootcamp NJ 2018 - Material
Introduction to Office Development Topics
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
VMworld 2016: Getting Started with PowerShell and PowerCLI for Your VMware En...
Behavior & Specification Driven Development in PHP - #OpenWest
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
Dancing with websocket
MWLUG 2015 - AD114 Take Your XPages Development to the Next Level
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)

More from Ricardo Wilkins (20)

PPTX
InfoPath - I Ain't Dead Yet!
PPTX
Ricardo Wilkins - Modern Work CSM @ Microsoft
DOCX
FAQ: Working with Files in Microsoft Teams
PPTX
Top Ten Tips for Teams - Microsoft Teams
PPTX
Microsoft Flow - A Real-World Walkthru
PPTX
Columbus SharePoint User Group - April 2019
PDF
OneNote - The Missing Manual
PPTX
Teams - The Missing Manual
PPTX
Microsoft Teams - The Missing Manual
PPTX
SharePoint Cincy 2018 - Site Management - Notes from the Field
PPTX
OneNote Overview
PPTX
SharePoint, PowerApps, Flow and Azure Functions - What Does It All Mean?
PPTX
When Your CISO Says No - Security & Compliance in Office 365
PPTX
Moving Your SharePoint Development to the Cloud
PPTX
InfoPath
PPTX
SharePoint 2013 Dev Features
PPTX
Cloud Computing Tips for Small Business
PPTX
The ABC’s of Building Apps for SharePoint 2013
PPTX
SharePoint & Azure Integration
PPTX
DevOps - Bridging the gap between development and operations
InfoPath - I Ain't Dead Yet!
Ricardo Wilkins - Modern Work CSM @ Microsoft
FAQ: Working with Files in Microsoft Teams
Top Ten Tips for Teams - Microsoft Teams
Microsoft Flow - A Real-World Walkthru
Columbus SharePoint User Group - April 2019
OneNote - The Missing Manual
Teams - The Missing Manual
Microsoft Teams - The Missing Manual
SharePoint Cincy 2018 - Site Management - Notes from the Field
OneNote Overview
SharePoint, PowerApps, Flow and Azure Functions - What Does It All Mean?
When Your CISO Says No - Security & Compliance in Office 365
Moving Your SharePoint Development to the Cloud
InfoPath
SharePoint 2013 Dev Features
Cloud Computing Tips for Small Business
The ABC’s of Building Apps for SharePoint 2013
SharePoint & Azure Integration
DevOps - Bridging the gap between development and operations

Recently uploaded (20)

PPTX
MYSQL Presentation for SQL database connectivity
PPT
Teaching material agriculture food technology
PDF
KodekX | Application Modernization Development
PDF
Encapsulation theory and applications.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Cloud computing and distributed systems.
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
MYSQL Presentation for SQL database connectivity
Teaching material agriculture food technology
KodekX | Application Modernization Development
Encapsulation theory and applications.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
“AI and Expert System Decision Support & Business Intelligence Systems”
Cloud computing and distributed systems.
20250228 LYD VKU AI Blended-Learning.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Spectral efficient network and resource selection model in 5G networks
Unlocking AI with Model Context Protocol (MCP)
Agricultural_Statistics_at_a_Glance_2022_0.pdf
cuic standard and advanced reporting.pdf
MIND Revenue Release Quarter 2 2025 Press Release

SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience

  • 1. SharePoint PowerShell for the Admin & Developer A Venn Diagram Experience #DogFoodCon Ryan Dennis | Ricardo Wilkins
  • 2. What we’re barking about What is PowerShell? PowerShell and SharePoint – the evolution Scripts vs. code – comparison Business case walk through Code integration with PowerShell Architectural discussions #DogFoodCon
  • 3. Meet the Mutts Ryan Dennis Ricardo Wilkins Consultant, Blue Chip Consulting Group Consultant, Blue Chip Consulting Group #DogFoodCon
  • 5. What is PowerShell? …is a task-based command-line shell and scripting language designed especially for Windows system administration …has a task-based scripting language …includes powerful object manipulation capabilities …is built on the .NET Framework #DogFoodCon
  • 6. PowerShell deals with Objects, not Strings • In order to find out what you can and cannot do or see on an object, use the Get-Member cmdlet • Get-Member will return all Methods and Properties associated with whatever item you pass to it • PowerShell uses a Verb-Noun syntax for its Cmdlets • Get-Something • Set-Something • New-Something #DogFoodCon
  • 7. The Pipeline • PowerShell passes objects, that is – when you do something like Get-Process, you’re retrieving process object(s) – you can then pipe that output, or that process object to Stop-Process, Select-Object, WhereObject, etc. • Use the built-in $_ variable to get values from the current object in the pipeline… • Let’s talk about this metaphorically…  #DogFoodCon
  • 9. SharePoint 2010 Cmdlets • 500+ Cmdlets… • MUCH better than STSADM.exe… • Can automate complete installations and configurations… • Still doesn’t answer every scenario, leaving gaps in functionality… • Example: Get, New and Remove SharePoint Groups – no cmdlet, easy to write a custom function though… #DogFoodCon
  • 10. As a Developer, why do I care? • Not always necessary to write code • Use PowerShell to handle things you could do in C# • Don’t write console apps, write PowerShell Scripts! • Some clients don’t allow managed code deployments, but PowerShell is A-OK #DogFoodCon
  • 11. Managing Solutions & Features Farm Solutions • • • • • Add-SPSolution Get-SPSolution Install-SPSolution Remove-SPSolution RemoveSPSolutionDeployme ntLock • Uninstall-SPSolution • Update-SPSolution #DogFoodCon Sandboxed Solutions • Add-SPUserSolution • Get-SPUserSolution • InstallSPUserSolution • RemoveSPUserSolution • UninstallSPUserSolution • UpdateSPUserSolution Features • • • • • Disable-SPFeature Enable-SPFeature Get-SPFeature Install-SPFeature Uninstall-SPFeature
  • 12. Retrieving SharePoint Objects • Multiple ways to get a Site Object using PowerShell… • $Site = Get-SPSite • $Site = New-Object Microsoft.SharePoint.SPSite($Url) • Multiple ways to get a Web Object using PowerShell… • $Web = $Site.RootWeb • $Web = $Site.OpenWeb() • $Web = Get-SPWeb #DogFoodCon
  • 13. The Evolution of SP Scripting • About 200 cmds • Over 500 • Over 700 • No native support PowerShell cmdlets PowerShell cmdlets for PowerShell* • PowerShell Version • PowerShell Version • STSADM was it 2.0 3.0 #DogFoodCon *You could use PowerShell by loading the Microsoft.SharePoint Assembly…
  • 14. Pros & Cons of Script vs. Code Script Pros Quicker to write Easier to edit (open a file, edit it) No need to install a DLL to the server Can access the hundreds (thousands?) of other PowerShell cmdlets (Processes, Services, etc.) #DogFoodCon Code Cons Requires more time to develop& deploy Editing requires redeployment to server Requires a DLL installation
  • 15. C# vs. PowerShell // register controls protected TextBox TextBoxMinutesPerSession; protected LinkButton LinkButtonUpdate; // Create a click event handler LinkButtonUpdate.Click += new EventHandler(LinkButtonUpdate_Click); void LinkButtonUpdate_Click(object sender, EventArgs e) Both code snippets add or set the { // Grab the site and web Guid “CurrentUserSessionDuration” Guid sitedId = SPContext.Current.Site.ID; property in a Web. Guid webID = SPContext.Current.Web.ID; //create and dispose of spweb and spsite objects using (SPSite oSPSite = new SPSite(sitedId)) { using (SPWeb oWeb = oSPSite.OpenWeb(webID)) { //Set the custom web property to the textbox value oWeb.Properties["CurrentUserSessionDuration"] = TextBoxMinutesPerSession.Text; oWeb.Properties.Update(); } $web = Get-SPWeb http://url } $web.Properties["CurrentUserSessionDuration"] = "60" } $web.Properties.Update() $web.Dispose() #DogFoodCon
  • 18. Get-Process –Name “Demo” | Start-Process #DogFoodCon
  • 19. Developer + PS IIS Server SharePoint Call PowerShell SPList Log ListItems #DogFoodCon Change Titles PS1
  • 20. SharePoint -Classic Web Part -Visual Web Part -SP2013 App Part #DogFoodCon
  • 23. -Files reside in e.g. C:Scripts -Scripts calling scripts as functions -Storing scripts in source control (TFS) -BA/PM viewing scripts vs code #DogFoodCon
  • 24. SPList Log ListItems function Write-SPAppLogItem { [CmdletBinding()] Param( [Parameter(Mandatory=$true)][System.String]$WebUrl, [Parameter(Mandatory=$true)][System.String]$ListName ) $web = Get-SPWeb $WebUrl $list = $web.Lists[$ListName] $item = $list.Items.Add() $date = Get-Date $item["Title"] = "Operation completed successfully: $date" $item.Update() $web.Dispose() } #DogFoodCon
  • 25. SPList Log ListItems -BA/PM responsible for this list -Workflow can kickoff on New Item -Other apps, or Search, can pull from this list #DogFoodCon
  • 26. Why is this worth chewing on? Separation of Devs vs Ops Devs maintain the UI Ops maintains the Title Change process Separation of Concerns / Single Responsibility pattern #DogFoodCon
  • 27. Other things to chew on? PS in Office 365 PS in Azure PS Remoting PS Workflow #DogFoodCon
  • 28. Barks from the Pack Thoughts? Would this model work for you? Other ideas? #DogFoodCon

Editor's Notes

  • #2: http://powerguivsx.codeplex.com/