The document provides details about Boulos Dib, an independent consultant with over 30 years of experience in software development. It lists his early experiences with computers and operating systems. It then outlines his agenda for a presentation on PowerShell and SharePoint, including a review of PowerShell concepts, the SharePoint Management Shell, common cmdlets, best practices, sample scripts and tools.
4.16.24 21st Century Movements for Black Lives.pptx
Boulos Dib's Guide to PowerShell and SharePoint Management
1. Boulos Dib
November 16, 2011
http://blog.boulosdib.com @boulosdib
2. PS> Describe-Presenter
Independent Consultant – Napeague Inc.
Professional Software Development since 1983
Few Facts
First Personal Computer 1980 – TRS-80 III
First Z80 based product (EPROM based Protocol Adaptor – 1984)
First Commercial PC-DOS product (Telex on PCs – 1985)
Started 16-bit Windows Development using Win 3.1
Developed on: 8080/Z80, 68xxx, PDP/RSX,VAX-VMS and x86/x64 (C/C++/C#)
Worked with PowerShell since Monad (2006)
Worked with SharePoint since STS (2003)
More facts
Favorite sport – Windsurfing
Favorite hobby – Playing my sunburst Fender Stratocaster+ guitar.
Favorite guitar players
Wes Montgomery, Larry Carlton and Ritchie Blackmore (Deep Purple, Rainbow)
3. Agenda
Quick PowerShell Review
SharePoint 2010 Management Shell
PowerShell (Functions, CmdLet)
SharePoint CmdLets by Group
Best Practices
Sample Scripts
Tools
Resources
5. Review - What is a shell
“A shell is the piece of software that lets you access the
functionality provided by the operating system. “
Bruce Payette - Co-Designer and Implementer of the
PowerShell language.
Example
Windows Explorer
Command.com
Cmd.exe
Bash (Unix)
PowerShell
6. Review - Consistent Environment
Common Parameters
-Verbose
-Debug
-WarningAction
-WarningVariable
-ErrorAction
-ErrorVariable
-OutVariable
-OutBuffer
Risk Mitigation Parameters (certainly critical in a production environment)
What-If
-Confirm
Whildcard support.
All names and parameter value can support wildcard.
Pipeline
7. Where do I start
Verb-XXNoun
Verbs: Get, Set, New, Write, Read
Nouns: Drive, Variable, Provider, Site, Collection
Most important command
Get-Help
Get-Help *
Get-Help *drive*
Get-Member
Get-Command
9. Functions
Functions is a script block containing list of statements
function small_files ($size = 100MB) {
Get-ChildItem c: | where { $_.length -lt $size -and
!$_.PSIsContainer}
}
To control how a function uses the pipeline, you use Begin,
Process and End.
function pipelineFunction {
process {"The value is: $_"}
}
1,2,3 | pipelineFunction
Advanced functions allow you to write CmdLets using scripts
instead of compiled code.
10. Scripts
A Script file is a text file with .ps1 extension containing
one or more PowerShell command
A Script is a simple mechanism to re-use functionality.
To run a script on a remote computer, use the Invoke-
Command and provide remote computer name as a
parameter.
Scripts can accept parameters.
To run a script in the current session, we Dot-Source
the . .Script1.ps1
We can Scope Local or Global.
11. Error Handling
Terminating vs. Nonterminating Errors
Trap
Throw – Sometime useful for parameters
function hi ($name=$(throw '$name is required')) {"Hi
$name"}
12. Errors Handling – as in C#
try
{
$wc = new-object System.Net.WebClient
$wc.DownloadFile("http://www.contoso.com/MyDoc.doc")
}
catch [System.Net.WebException],[System.IO.IOException]
{
unable to download MyDoc.doc from http://www.contoso.com."
}
catch
{
"An error occurred that could not be resolved."
}
25. Books – PowerShell
PowerShell in Action Windows PowerShell 2.0 Bible
Bruce Payette By Thomas Lee, Karl Mitschke,
“The book from the authority on Mark E. Schill, and Tome
PowerShell” Tanasovski
http://powertoe.wordpress.com/
(Tome’s blog)
26. Books – PowerShell & SharePoint
Automating Microsoft SharePoint PowerShell for Microsoft
2010 Administration with Windows Sharepoint 2010 Administrators.
PowerShell 2.0
Gary Lapointe & Shannon Bray Niklas Goude & Mattias Karlsson
http://blog.falchionconsulting.com/ http://www.powershell.nu/
http://mysharepointofview.com/
http://sppowershell.com/