intro to powershell jack fruh sharepointjack.com
TRANSCRIPT
Intro To PowerShell
Jack FruhSharepointjack.com
And now a word from ourSponsors
Thank you #SPSTC sponsors!
About Me…
@sharepointjack
SharePointJack.com
Last year was a milestone year, as the site crossed the 5 unique visitors milestone. I’m pretty sure my Mom and Dad were two
of them, I can only guess that my uncle Hershel and aunt Mildred were also enticed to visit the site after the yearly
family Christmas newsletter went out. People still do those right?
Demo
• How to start PowerShell,• The difference between “Plain” and
“SharePoint” PowerShell• Your first PS command: Get-Command• Your first PS Program:• $a = get-command• $a.count()
Demo (cont)
• Turn “plain” PowerShell into “SharePoint” PowerShell with this command:
• Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
What you should do to learn PowerShell
1) Download the PowerShell Cheat Sheet
2) Print it3) Tape it on
your desk
What you should do to learn PowerShell & SharePoint
1) Download the SharePoint PS Cheat Sheet
2) Print it3) Tape it on
your desk4) Look over the
SP Object Model
Understanding SharePoint’s internals will help greatly!
• Knowing the “Object Model” will go a long, long, long, long, long way towards knowing what to look for in PowerShell or what to search for on the internet when seeking help
SharePoint Object Model Compared to a School System
SPFarm Farm is the top level in the object model. Managed via Central Admin A farm will have one or more Web
Applications SPWebApplication Found in IIS as an IIS website Determines the Base URL of the site Contains 1 ore more Site Collections
SPSite Same as “Site Collection” An Organizational unit Can easily move a whole SPSite
between Databases Each SPSite contains 1 ore more
SPWEB’s
SPWeb Where real work happens Contains Lists, libraries, Pages, etc..
School District School District oversees all schools in the
district. Address of Office ≠ Address of School(s) A School District will have 1 or more
SchoolsSchool Found within the physical boundaries of
the taxing school districts geographical area
Has a physical address people go to. Has 1 or more Departments
Department A way to organize teachers and
classes by purpose Math Department Athletic Department etc.
Classroom Where learning happens Contains books, supplies,
whiteboards, etc.
Exploring SharePoint PowerShell
• Get-Command *-SP*• Get-help• Get-Help (command)• Get-help get-spweb• Get-help get-spweb –detailed• Get-help get-spweb –examples
Understanding Help Output
Understanding the “Syntax” part…
“Pipe” output from one command to the Input of another
The most Common “Pipe Targets”Some-Command | Sort name, dateSome-Command | Format-TableSome-Command | Select nameSome-Command | Select –last 3Some-Command | Where {$_.name –like “Jack*”}
Graduating from one line commands:Scripts & the “ISE”
(Integrated Scripting Environment)
ISE Scripting
• Since the ISE opens “Plain”, be sure to add in the SharePoint PowerShell Snapin with
Add-PSSnapin Microsoft.SharePoint.PowerShell
Example/Demo’s and Questions:Save all the WSP’s on your farm….
Example/Demo
See how big your Content Databases Are…