PowerShell for SharePoint - SharePoint Saturday Montréal 2014
SPSBE 2012 - PowerShell and SharePoint
-
Upload
sharepointbaker -
Category
Technology
-
view
498 -
download
0
description
Transcript of SPSBE 2012 - PowerShell and SharePoint
![Page 1: SPSBE 2012 - PowerShell and SharePoint](https://reader035.fdocuments.net/reader035/viewer/2022062704/5560b78cd8b42af43b8b4b34/html5/thumbnails/1.jpg)
Adam Burcher
PowerShell your SharePoint environment from setup to finish
#SPSBE
#SPSBE20
![Page 2: SPSBE 2012 - PowerShell and SharePoint](https://reader035.fdocuments.net/reader035/viewer/2022062704/5560b78cd8b42af43b8b4b34/html5/thumbnails/2.jpg)
About me
• Adam Burcher
• http://www.thesharepointbaker.co.uk
• #sharepointbaker
• SharePoint Developer & IT
![Page 3: SPSBE 2012 - PowerShell and SharePoint](https://reader035.fdocuments.net/reader035/viewer/2022062704/5560b78cd8b42af43b8b4b34/html5/thumbnails/3.jpg)
A big thanks to our sponsors
Venue Sponsor
Platinum Sponsors
Gold Premium Sponsors
Gold Sponsors
![Page 4: SPSBE 2012 - PowerShell and SharePoint](https://reader035.fdocuments.net/reader035/viewer/2022062704/5560b78cd8b42af43b8b4b34/html5/thumbnails/4.jpg)
Agenda
• PowerShell – what, why and who?
• Out of the Box
• Writing custom functions
• Demo
• Build a SharePoint Farm
• Configure a site
• Deploy code and then content
![Page 5: SPSBE 2012 - PowerShell and SharePoint](https://reader035.fdocuments.net/reader035/viewer/2022062704/5560b78cd8b42af43b8b4b34/html5/thumbnails/5.jpg)
PowerShell – what?
• Scripting language/framework
• Configuring Server technologies – SharePoint, Windows, Active Directory, Exchange....
• Blurs the lines between scripting (e.g. MS DOS) and code (e.g. C#)
![Page 6: SPSBE 2012 - PowerShell and SharePoint](https://reader035.fdocuments.net/reader035/viewer/2022062704/5560b78cd8b42af43b8b4b34/html5/thumbnails/6.jpg)
PowerShell – why?
• Automation – if its scripted, you can run it again
• Documented – scripts can form documentation
• Simplified rolls outs – scripts do all the work
• Distinction between ‘Code’, ‘Content’ and ‘Configuration’
• Code = WSP, C#, DLL
• Content & Configuration = PowerShell
![Page 7: SPSBE 2012 - PowerShell and SharePoint](https://reader035.fdocuments.net/reader035/viewer/2022062704/5560b78cd8b42af43b8b4b34/html5/thumbnails/7.jpg)
PowerShell – who?
• IT Admins & Dev
• One option – IT Admin manage scripts for server, farm and web app setup. Dev everything else.
• “Befriend a Dev”
• If SharePoint offers collaboration across a business, PowerShell is collaboration between IT Admins and Dev
![Page 8: SPSBE 2012 - PowerShell and SharePoint](https://reader035.fdocuments.net/reader035/viewer/2022062704/5560b78cd8b42af43b8b4b34/html5/thumbnails/8.jpg)
Out of the box
• SharePoint comes with a number of very useful cmdlets
• New-SPWebApplication
• Get-SPSite
• Typically you can interchange the ‘verb’ – New, Get, Set
• Extend by wrapping custom logic – ifs, loops, etc
$managedAccount = Get-SPManagedAccount | ?{$_.UserName –eq “tsb\appPoolAccount”}
if (-not $managedAccount){
New-SPManagedAccount –credientials $credientials}
![Page 9: SPSBE 2012 - PowerShell and SharePoint](https://reader035.fdocuments.net/reader035/viewer/2022062704/5560b78cd8b42af43b8b4b34/html5/thumbnails/9.jpg)
Writing custom scripts
• You can write custom cmdlets in code and compile
• Custom functions don’t require “code” (& compiling)
• Good news is you can access the SharePoint OM
• Bad news is you can access the SharePoint OM
• Good C# Code...can make good PowerShell
• Bad C# Code...will make bad PowerShell
• Treat PowerShell as Production Code
![Page 10: SPSBE 2012 - PowerShell and SharePoint](https://reader035.fdocuments.net/reader035/viewer/2022062704/5560b78cd8b42af43b8b4b34/html5/thumbnails/10.jpg)
The Scripts
Create the Farm &
Central Admin Create our Web App &
Site CollectionDeploy
Features Deploy Content
• Deploy-me.ps1 {args}
deploy
webapp
farmsetup
content
![Page 11: SPSBE 2012 - PowerShell and SharePoint](https://reader035.fdocuments.net/reader035/viewer/2022062704/5560b78cd8b42af43b8b4b34/html5/thumbnails/11.jpg)
Demo
Building our Farm & Site
![Page 12: SPSBE 2012 - PowerShell and SharePoint](https://reader035.fdocuments.net/reader035/viewer/2022062704/5560b78cd8b42af43b8b4b34/html5/thumbnails/12.jpg)
What’s next?
• Extend scripts for other elements –
• Service Applications – search, meta data etc
• Other content – new Webs (site hierarchy)
• Permissions, users, documents etc
• Create EnvVars for UAT, Prod etc
• Write a Release Note & Document!
• Test Scripts!
• Remember, anytime you go to Central Admin or your site to make a change, think – should you script it?
![Page 13: SPSBE 2012 - PowerShell and SharePoint](https://reader035.fdocuments.net/reader035/viewer/2022062704/5560b78cd8b42af43b8b4b34/html5/thumbnails/13.jpg)
Q&A
Any questions…?
![Page 14: SPSBE 2012 - PowerShell and SharePoint](https://reader035.fdocuments.net/reader035/viewer/2022062704/5560b78cd8b42af43b8b4b34/html5/thumbnails/14.jpg)
We need your feedback!
Scan this QR code or visit http://svy.mk/sps2012be
Our sponsors: