intro to powershell jack fruh sharepointjack.com

20
Intro To PowerShell Jack Fruh Sharepointjack.com

Upload: mavis-simon

Post on 03-Jan-2016

221 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Intro To PowerShell Jack Fruh Sharepointjack.com

Intro To PowerShell

Jack FruhSharepointjack.com

Page 2: Intro To PowerShell Jack Fruh Sharepointjack.com

And now a word from ourSponsors

Page 3: Intro To PowerShell Jack Fruh Sharepointjack.com

Thank you #SPSTC sponsors!

Page 4: Intro To PowerShell Jack Fruh Sharepointjack.com

About Me…

@sharepointjack

Page 5: Intro To PowerShell Jack Fruh Sharepointjack.com

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?

Page 6: Intro To PowerShell Jack Fruh Sharepointjack.com

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()

Page 7: Intro To PowerShell Jack Fruh Sharepointjack.com

Demo (cont)

• Turn “plain” PowerShell into “SharePoint” PowerShell with this command:

• Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

Page 8: Intro To PowerShell Jack Fruh Sharepointjack.com

What you should do to learn PowerShell

1) Download the PowerShell Cheat Sheet

2) Print it3) Tape it on

your desk

Page 9: Intro To PowerShell Jack Fruh Sharepointjack.com

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

Page 10: Intro To PowerShell Jack Fruh Sharepointjack.com

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

Page 11: Intro To PowerShell Jack Fruh Sharepointjack.com

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.

Page 12: Intro To PowerShell Jack Fruh Sharepointjack.com

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

Page 13: Intro To PowerShell Jack Fruh Sharepointjack.com

Understanding Help Output

Understanding the “Syntax” part…

Page 14: Intro To PowerShell Jack Fruh Sharepointjack.com

“Pipe” output from one command to the Input of another

Page 15: Intro To PowerShell Jack Fruh Sharepointjack.com

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*”}

Page 16: Intro To PowerShell Jack Fruh Sharepointjack.com

Graduating from one line commands:Scripts & the “ISE”

(Integrated Scripting Environment)

Page 17: Intro To PowerShell Jack Fruh Sharepointjack.com

ISE Scripting

• Since the ISE opens “Plain”, be sure to add in the SharePoint PowerShell Snapin with

Add-PSSnapin Microsoft.SharePoint.PowerShell

Page 18: Intro To PowerShell Jack Fruh Sharepointjack.com

Demos & Q&A

Contact info:

Jack [email protected]@sharepointjack

Page 19: Intro To PowerShell Jack Fruh Sharepointjack.com

Example/Demo’s and Questions:Save all the WSP’s on your farm….

Page 20: Intro To PowerShell Jack Fruh Sharepointjack.com

Example/Demo

See how big your Content Databases Are…