2. 2
Who is Michael Blumenthal?
Sr. Solution Architect
at PSC Group
CSPUG Co-Leader
INETA Champ 2010-2013
18 years in IT Consulting
10 years working with
SharePoint (2003,2007,2010, 2013)
3. 3
This is about you
Version of SharePoint?
Admin, Developer, Both, Other?
PowerShell experience?
SharePoint experience?
Unix experience?
Scripting experience?
5. 5
PowerShell puts the SharePoint
Engine at your fingertips!
• It’s Easy to Get Started!1
• Learn the PowerShell Syntax2
• Real World Examples3
• More Resources4
• Q&A & Raffle5
23. Making Comparisons4
Operator Meaning Operator Meaning
-eq Equals -le Less Than or
Equal To
-ne Not Equals -like Wildcard Match
-gt Greater Than -notlike Not (Wildcard
Match)
-ge Greater Than
or Equal To
-match Reg. Exp. Match
-lt Less Than -notmatch Not (Reg. Exp.
Match)
34. 34
Real World Examples
Check the Farm Version
Check Versioning on all document Libraries
Create List Items
Export Web App Properties to a file
Bulk Site Creation
35. 35
What’s your SP2010 Version?
PS C:UsersAdministrator> $(get-
SPFarm).BuildVersion
Major Minor Build Revision
----- ----- ----- --------
14 0 6109 5002
36. 36
Get a Site and Explore it!
$site = get-spsite http://server/path
THEN
$site
40. 40
Practical Uses
• Bulk Create Sites1
• List Item CRUD2
•Create data for test cases3
• Associate Workflows with a List4
•Work across site collections5
• Deployment Scripting6
• Identify files that won’t upload7
41. 41
More Practical Uses
• Sync Wep App Properties8
• Install SharePoint9
• Repeatably Manage Content10
• Update Field Definitions11
• Edit MP3 Metadata, Make Flashcards12
42. 42
What’s your SharePoint Version?
PS C:UsersAdministrator> $(get-
SPFarm).BuildVersion
Major Minor Build Revision
----- ----- ----- --------
14 0 6109 5002
46. 46
Bulk Site Creation
Site Definitions in V. Studio
Not an answer by themselves
Define site content
Intended for reuse
Mismatch to one time need
CAML and PITA
Harder: Making it data driven
Change Site Def -> Recreate Site
PowerShell & Excel & UI
Well suited for one time “blow
in’s”
Define the site template in the
UI or use standard
Save as a template
Even pub sites - sometimes
PowerShell has easy loops
Data driven from a CSV
Changes -> Mod Scripts
47. 47
The PowerShell Solution
Read the list of sites from CSV
Loop:
Create Site
Configure Site
Turn on Features
Set Master Pages, Welcome Page
Hide Libraries, set versioning
Adjust Navigation
Add Lists, Libraries, Pages, Web parts, etc
Loop again & again if needed – iterative!
57. 57
Resources Summary
MSFT
PowerShell Product Team Blog
Script Center
Community
Various Books
CodePlex: PSBBs (mine), CodePlex:SPInstaller
Blog.BlumenthalIT.Net
SharePointJack.com
Jeff Hicks , Gary LaPointe, Raymond Mitchell,
Todd Klindt, POSHCODE.ORG, get-spscripts.com
SPYam
59. 59
Questions
& Raffle
• Michael Blumenthal
SharePoint Architect
PSC Group, LLC
• MBlumenthal@psclistens.com
• psclistens.com
• www.cspug.org
• Twitter: @MichaelBL
• SPYam
Thank you for your time today.
Notas del editor
Every SharePoint Developer needs this!Fast and FlexibleGreat for LastMile Problems. New MSFT std for Scripting
Who would like another tool in their toolbox, one that will help them with SharePoint, but also with many other things? How about the swiss army knife of tools?It will make you a better developer!
Who here already has installed and PowerShell? Who’s using Server 2003? 2008?Win 2003: http://www.microsoft.com/windowsserver2003/technologies/management/powershell/download.mspxWin 2008 – It’s an OS Feature – “servermanagercmd –install PowerShell”V3 is here
One is SharePoint aware, the other isn’t!
Does anyone have any other names for these?Victor Borge has his own take on these: http://www.youtube.com/watch?v=lF4qii8S3gw
Name that Language…Similar to @variables in SQL, apparently also Ruby, PHP.Arrays start at 0
Mention Aliases
Ask if anyone has unix scripting experience, and what they think of this.Can you imagine trying to do this in unix or vbscript?
Get-Help about_flow_controlMention that collections start at 0
Ask if anyone has unix scripting experience, and what they think of this.Can you imagine trying to do this in unix or vbscript?
If you are familiar with these objects, raise your hand.
Your mother doesn’t work here! You must clean up after yourself.
Also:PoshCode.OrgTechNet Script Center http://www.microsoft.com/technet/scriptcenter/default.mspx MSDN SharePoint Developer Center http://msdn.microsoft.com/en-us/office/aa905503.aspx Zach Rosenfield’s Blog - http://sharepoint.microsoft.com/blogs/zach/default.aspxhttp://blog.falchionconsulting.com/http://www.powergui.org/downloads.jspahttp://thepowershellguy.com/blogs/posh/pages/powertab.aspx
You owe it to yourself to try out PowerShell.It will make you a better developer!