Have you been looking for ways to utilize PowerShell in your SharePoint environment, but don't have any practical scenarios? In this session learn which Cmdlets give you the best "bang for your buck" when working with administrative, provisioning and auditing duties. Get introduced to the gray space between administration and development when learning the differences between using PowerShell with an on-premise deployment or Office 365. Also, learn common tasks that should be turned into valuable scripts.
2. Who am I
• Manager, Consultant, Speaker and new dad of 2
• Email: bcaauwe@avtex.com
• Twitter: @bcaauwe
• Technical Editor
• Professional SharePoint 2013 Administration
• Certifications
• MCM: SharePoint Server 2010
• MCSM: SharePoint
Brian Caauwe
12. • Microsoft.SharePoint namespace
• Server Architecture
• SPFarm
• SPWebApplication
• SPContentDatabase
• Site Architecture
• SPSite
• SPWeb
• SPList
• SPListItem
• MSDN Resource
• https://msdn.microsoft.com/en-us/library/jj193058.aspx
Server Side
Object Model
13. • Uses powershell.exe same as on-prem
• Imports the module
• Microsoft.Online.SharePoint.PowerShell
• Sets ExecutionPolicy to RemoteSigned
• Only 131 Cmdlets
• Also includes Cmdlets for Azure AD Module
• Supplement
• Client Side Object Model (CSOM)
• Patterns and Practices (PnP)
Management Shell
Online
14. • Microsoft.SharePoint.Client namespace
• Starting Point
• Microsoft.SharePoint.Client.ClientContext
• Microsoft.SharePoint.Client.SharePointOnlineCredentials
• Microsoft.SharePoint.Client.Web
• Microsoft.SharePoint.Client.Site
• MSDN Resource
• https://msdn.microsoft.com/en-
us/library/microsoft.sharepoint.client.aspx
Client Side
Object Model
22. • End users request a site into a list
• Automate site creation
• Inform user of progress
• Enforce Governance
Site Request
23. Site Request
Lay of the land…
• List Location: http://portal.lab.com
• List Title: Site Requests
• Columns:
• Title* (Single line of text)
• Abbreviation* (Single line of text)
• Site Description (Multiple lines of text)
• Site Type* (Choice)
• Size* (Choice)
• Site Owner* (Person)
• Secondary Owner* (Person)
• Site Contributors (Person-Multi)
• Site Visitors (Person-Multi)
• Status (Choice) [Hidden]
• Default Value [Submitted]
• Status Description (Multiple lines of text) [Hidden]
* Required Fields
29. • Everything starts with the Client Context
Client Side
Object Model
$username = “user@email.com”
$password = ConvertTo-SecureString -String “pass@word1” -AsPlainText
-Force
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($url)
$ctx.Credentials = New-Object
Microsoft.SharePoint.Client.SharePointOnlineCredentials($username,
$password)
30. • Using Load and ExecuteQuery to use objects
Client Side
Object Model
$web = $ctx.Web
$site = $ctx.Site
$ctx.Load($web)
$ctx.Load($site)
$ctx.ExecuteQuery()
35. Resources
• Windows PowerShell for SharePoint 2013
• https://technet.microsoft.com/en-us/library/ee662539.aspx
• Office Dev Patterns and Practices GitHub
• https://github.com/SharePoint/PnP
• PnP PowerShell
• https://github.com/sharepoint/pnp-powershell/
• SharePoint Server 2013 Client Components SDK
• http://www.microsoft.com/en-us/download/details.aspx?id=35585
• SharePoint Online Management Shell
• http://www.microsoft.com/en-us/download/details.aspx?id=35588
• Display a list of OneDrive for Business Site Collections
• https://technet.microsoft.com/en-us/library/dn911464.aspx
• Using Lambda Expressions with CSOM in PowerShell
• http://www.itunity.com/article/loading-specific-values-lambda-expressions-sharepoint-csom-
api-windows-powershell-1249
36. Contact Info
• Email: bcaauwe@avtex.com
• Twitter: @bcaauwe
• SlideShare:
https://www.slideshare.net/BrianCaauwe
• Microsoft Tech Community:
https://techcommunity.microsoft.com/t5/user/viewp
rofilepage/user-id/2831
• MNSPUG: http://www.sharepointmn.com
Brian Caauwe
Editor's Notes
You won’t learn by books or sessions
Find YOUR practical applications
Use Get-Help for information on Cmdlets
Full property for verbose information
Examples for… Examples