SlideShare a Scribd company logo
1 of 36
PowerShell: Through the SharePoint
Looking Glass
Brian Caauwe @bcaauwe
April 14th, 2018
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
Thank you #SPSTC
sponsors!
Poll
https://bit.ly/2GZRZFz
Microsoft Forms
Agenda
Investigation
Automation
Learning
Get-Help
• ALWAYS run “As Administrator”
• Uses powershell.exe under Windowssystem32
• Microsoft.SharePoint.Powershell snap-in
– C:Program FilesCommon FilesMicrosoft SharedWeb Server
Extensions15[6]CONFIGPOWERSHELLRegistrationsharepoint.ps1
• Sets ExecutionPolicy to RemoteSigned
• 700+ Cmdlets – SharePoint 2013
• 800+ Cmdlets – SharePoint 2016
Management Shell
On-Premise
• 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
• 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
• 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
• Call PowerShell from Windowssystem32
• Register Microsoft.SharePoint.Powershell snap-in
-psconsolefile “C:Program FilesCommon FilesMicrosoft
SharedWeb Server Extensions15[6]CONFIGPOWERSHELL
Registrationpsconsole.psc1”
• Call Script
-command “E:PowerShellSet-ScriptName.ps1”
• Logging
Scheduled Tasks
Memory Leaks
• Disposable Objects
$web.Dispose()
$site.Dispose()
• SPAssignment – Garbage Collector
Global
Start-SPAssignment -Global
Get-SPSite –Limit All | Get-SPWeb | Select Url, WebTemplate, WebTemplateId
Stop-SPAssignment -Global
Scoped
$w = Get-SPWebApplication http://www.company.com
$siteScope = Start-SPAssignment
foreach ($site in ($siteScope | Get-SPSite -Limit All –WebApplication $))
{
$webScope = Start-SPAssignment
foreach ($web in ($webScope | Get-SPWeb -Limit All -Site $site))
{
## Do Something
}
Stop-SPAssignment $webScope
}
Stop-SPAssignment $siteScope
• Other Assemblies
• IIS (WebAdministration)
• SQL
• Exchange
• User Profile
• Microsoft.Office.Server.UserProfiles
• Managed Metadata
• Microsoft.SharePoint.Taxonomy
On-prem
• High Level Cmdlets
• Get-SPWebApplication
• Get-SPSite
• Get-SPWeb Day-to-Day
$w = Get-SPWebApplication http://my.company.com
$site = Get-SPSite http://my.company.com
$site | Get-SPWeb -Limit All
• Will utilize Log Cmdlets
• New-SPLogFile
• Merge-SPLogFile
Troubleshooting
New-SPLogFile
Merge-SPLogFile –Path “C:Debugerror.log” –Correlation
470a4ec2-985d-43be-a14e-176eb1c39672
• Will utilize SPSolution Cmdlets
• Add-SPSolution
• Get-SPSolution
• Install-SPSolution
Customizations
Add-SPSolution –LiteralPath “C:Solutionsspcmis.wsp”
$sol = Get-SPSolution | ?{$_.Name –eq “spcmis.wsp”}
$sol | Install-SPSolution –GACDeployment –AllWebApplications –Compatibilitylevel All
• End users request a site into a list
• Automate site creation
• Inform user of progress
• Enforce Governance
Site Request
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
Site Request Process
Demo
Online
• Utilize Cmdlet
• Connect-SPOService
Connecting
Connect-SPOService –url https://tenant-admin.sharepoint.com
• Limited Cmdlets
• Get/Set-SPOSite
• Get/Set/Remove-SPOUser
Day-to-Day
$site = Get-SPSite https://[tenant].sharepoint.com
Set-SPOUser -LoginName user@email.com -Site $site -IsSiteCollectionAdmin $true
Core
Objects
CSOM
• 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)
• 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()
$creds = New-Object System.Management.Automation.PSCredential
“user@email.com”, (ConvertTo-SecureString “pass@word1” -AsPlainText
-force)
Connect-PnPOnline –Url $url –Credentials $creds
$ctx = Get-PnPContext
$ctx.RequestTimeout = [System.Threading.Timeout]::Infinite
$root = Get-PnPWeb
Starts with the Connect-PnPOnline
Revolves around PnPContext
PnP
PowerShell
$provisioningList = Get-PnPList -Identity $listName
$query = "<View><Query><Where><Eq><FieldRef Name='Status'></FieldRef><Value
Type='Text'>Submitted</Value></Eq></Where></Query></View>"
$items = Get-PnPListItem -List $provisioningList -Query $query
Set-PnPListItem -List "Provisioning List" -Identity $item.Id -Values
@{"Status"="In Progress";"StatusDescription"="Starting site creation process"}
New-PnPGroup -Title $ownerGroupName -Owner $siteOwner.Email
Get-PnPGroup -AssociatedOwnerGroup -Web $web
Set-PnPGroup -Identity $ownersGroup -SetAssociatedGroup Owners
Set-PnPGroupPermissions -Identity $ownersGroup -AddRole "Full Control“
Add-PnPUserToGroup -LoginName $siteOwner.Email -Identity $ownersGroup
Wraps CSOM methods and objects
New-PnPTenantSite -Title $item.Title -Url $siteLocation -Owner
$siteOwner.Email -TimeZone 11 -Description $siteDescription -Template
$siteTemplate –Wait
New-PnPWeb -Title $item.Title -Url $webLocation -Template $siteTemplate -Web
$parentWeb -Locale 1033 -BreakInheritance
PnP
PowerShell
PnP PowerShell
Demo
Questions
Please give me feedback
https://guidebook.com/guide/123531/event/18208880
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
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

More Related Content

What's hot

Serverless Ballerina
Serverless BallerinaServerless Ballerina
Serverless BallerinaBallerina
 
Service Workers for Performance
Service Workers for PerformanceService Workers for Performance
Service Workers for PerformancePatrick Meenan
 
HTML5 Hacking - Yahoo! Open Hack Day
HTML5 Hacking - Yahoo! Open Hack DayHTML5 Hacking - Yahoo! Open Hack Day
HTML5 Hacking - Yahoo! Open Hack DayTed Drake
 
Choosing a Javascript Framework
Choosing a Javascript FrameworkChoosing a Javascript Framework
Choosing a Javascript FrameworkAll Things Open
 
Advance java session 8
Advance java session 8Advance java session 8
Advance java session 8Smita B Kumar
 
(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...
(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...
(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...Amazon Web Services
 
Scalable web application architecture
Scalable web application architectureScalable web application architecture
Scalable web application architecturepostrational
 
(WEB203) Building a Website That Costs Pennies to Operate | AWS re:Invent 2014
(WEB203) Building a Website That Costs Pennies to Operate | AWS re:Invent 2014(WEB203) Building a Website That Costs Pennies to Operate | AWS re:Invent 2014
(WEB203) Building a Website That Costs Pennies to Operate | AWS re:Invent 2014Amazon Web Services
 
[1C1]Service Workers
[1C1]Service Workers[1C1]Service Workers
[1C1]Service WorkersNAVER D2
 
Grails Plugins(Console, DB Migration, Asset Pipeline and Remote pagination)
Grails Plugins(Console, DB Migration, Asset Pipeline and Remote pagination)Grails Plugins(Console, DB Migration, Asset Pipeline and Remote pagination)
Grails Plugins(Console, DB Migration, Asset Pipeline and Remote pagination)NexThoughts Technologies
 
06 integrate elasticsearch
06 integrate elasticsearch06 integrate elasticsearch
06 integrate elasticsearchErhwen Kuo
 
03 integrate webapisignalr
03 integrate webapisignalr03 integrate webapisignalr
03 integrate webapisignalrErhwen Kuo
 
04 integrate entityframework
04 integrate entityframework04 integrate entityframework
04 integrate entityframeworkErhwen Kuo
 
Get Real: Adventures in realtime web apps
Get Real: Adventures in realtime web appsGet Real: Adventures in realtime web apps
Get Real: Adventures in realtime web appsdaviddemello
 
BDD in Java using Cucumber
BDD in Java using CucumberBDD in Java using Cucumber
BDD in Java using Cucumberslavkurochkin
 
Microsoft Azure Web Sites Performance Analysis Lessons Learned
Microsoft Azure Web Sites Performance Analysis Lessons LearnedMicrosoft Azure Web Sites Performance Analysis Lessons Learned
Microsoft Azure Web Sites Performance Analysis Lessons LearnedChris Woodill
 

What's hot (20)

Serverless Ballerina
Serverless BallerinaServerless Ballerina
Serverless Ballerina
 
Service Workers for Performance
Service Workers for PerformanceService Workers for Performance
Service Workers for Performance
 
Iac d.damyanov 4.pptx
Iac d.damyanov 4.pptxIac d.damyanov 4.pptx
Iac d.damyanov 4.pptx
 
HTML5 Hacking - Yahoo! Open Hack Day
HTML5 Hacking - Yahoo! Open Hack DayHTML5 Hacking - Yahoo! Open Hack Day
HTML5 Hacking - Yahoo! Open Hack Day
 
Choosing a Javascript Framework
Choosing a Javascript FrameworkChoosing a Javascript Framework
Choosing a Javascript Framework
 
Grails Plugins
Grails PluginsGrails Plugins
Grails Plugins
 
Bosh 2.0
Bosh 2.0Bosh 2.0
Bosh 2.0
 
Advance java session 8
Advance java session 8Advance java session 8
Advance java session 8
 
(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...
(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...
(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...
 
Scalable web application architecture
Scalable web application architectureScalable web application architecture
Scalable web application architecture
 
(WEB203) Building a Website That Costs Pennies to Operate | AWS re:Invent 2014
(WEB203) Building a Website That Costs Pennies to Operate | AWS re:Invent 2014(WEB203) Building a Website That Costs Pennies to Operate | AWS re:Invent 2014
(WEB203) Building a Website That Costs Pennies to Operate | AWS re:Invent 2014
 
[1C1]Service Workers
[1C1]Service Workers[1C1]Service Workers
[1C1]Service Workers
 
Grails Plugins(Console, DB Migration, Asset Pipeline and Remote pagination)
Grails Plugins(Console, DB Migration, Asset Pipeline and Remote pagination)Grails Plugins(Console, DB Migration, Asset Pipeline and Remote pagination)
Grails Plugins(Console, DB Migration, Asset Pipeline and Remote pagination)
 
06 integrate elasticsearch
06 integrate elasticsearch06 integrate elasticsearch
06 integrate elasticsearch
 
03 integrate webapisignalr
03 integrate webapisignalr03 integrate webapisignalr
03 integrate webapisignalr
 
04 integrate entityframework
04 integrate entityframework04 integrate entityframework
04 integrate entityframework
 
Get Real: Adventures in realtime web apps
Get Real: Adventures in realtime web appsGet Real: Adventures in realtime web apps
Get Real: Adventures in realtime web apps
 
BDD in Java using Cucumber
BDD in Java using CucumberBDD in Java using Cucumber
BDD in Java using Cucumber
 
Microsoft Azure Web Sites Performance Analysis Lessons Learned
Microsoft Azure Web Sites Performance Analysis Lessons LearnedMicrosoft Azure Web Sites Performance Analysis Lessons Learned
Microsoft Azure Web Sites Performance Analysis Lessons Learned
 
Node.js and Parse
Node.js and ParseNode.js and Parse
Node.js and Parse
 

Similar to SPSTC - PowerShell - Through the SharePoint Looking Glass

SPO Migration - New API
SPO Migration - New APISPO Migration - New API
SPO Migration - New APIAshish Trivedi
 
Power Shell and Sharepoint 2013
Power Shell and Sharepoint 2013Power Shell and Sharepoint 2013
Power Shell and Sharepoint 2013Mohan Arumugam
 
Operacion Guinda 2
Operacion Guinda 2Operacion Guinda 2
Operacion Guinda 2Red RADAR
 
PowerShell Basics for Office Apps and Servers
PowerShell Basics for Office Apps and ServersPowerShell Basics for Office Apps and Servers
PowerShell Basics for Office Apps and ServersGreg McMurray
 
ASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin LauASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin LauSpiffy
 
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...Comunidade Portuguesa de SharePoiint
 
Powershell to the People #suguk
Powershell to the People #sugukPowershell to the People #suguk
Powershell to the People #sugukChris McKinley
 
Automating OSD and Post-OSD Configuration with Powershell and Orchestrator
Automating OSD and Post-OSD Configuration with Powershell and OrchestratorAutomating OSD and Post-OSD Configuration with Powershell and Orchestrator
Automating OSD and Post-OSD Configuration with Powershell and OrchestratorDigicomp Academy AG
 
Office 365 & PowerShell - A match made in heaven
Office 365 & PowerShell - A match made in heavenOffice 365 & PowerShell - A match made in heaven
Office 365 & PowerShell - A match made in heavenSébastien Levert
 
The Path through SharePoint Migrations
The Path through SharePoint MigrationsThe Path through SharePoint Migrations
The Path through SharePoint MigrationsBrian Caauwe
 
[Vončina] Configuring SharePoint 2016 for BI Scenarios
[Vončina] Configuring SharePoint 2016 for BI Scenarios[Vončina] Configuring SharePoint 2016 for BI Scenarios
[Vončina] Configuring SharePoint 2016 for BI ScenariosEuropean Collaboration Summit
 
Share point hosted add ins munich
Share point hosted add ins munichShare point hosted add ins munich
Share point hosted add ins munichSonja Madsen
 
The Path Through SharePoint Migrations
The Path Through SharePoint MigrationsThe Path Through SharePoint Migrations
The Path Through SharePoint MigrationsBrian Caauwe
 
The Power of Document Generation with Nintex
The Power of Document Generation with NintexThe Power of Document Generation with Nintex
The Power of Document Generation with NintexBrian Caauwe
 
WinOps Conf 2016 - Michael Greene - Release Pipelines
WinOps Conf 2016 - Michael Greene - Release PipelinesWinOps Conf 2016 - Michael Greene - Release Pipelines
WinOps Conf 2016 - Michael Greene - Release PipelinesWinOps Conf
 
An Introduction to the Office 365 Patterns and Practices Project
An Introduction to the Office 365 Patterns and Practices ProjectAn Introduction to the Office 365 Patterns and Practices Project
An Introduction to the Office 365 Patterns and Practices ProjectSPC Adriatics
 
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...Sébastien Levert
 
Access Apps for Office 365 with Power BI
Access Apps for Office 365 with Power BIAccess Apps for Office 365 with Power BI
Access Apps for Office 365 with Power BIChris McNulty
 
Build Your First SharePoint Framework Webpart
Build Your First SharePoint Framework WebpartBuild Your First SharePoint Framework Webpart
Build Your First SharePoint Framework WebpartEric Overfield
 
Webinar - Office 365 & PowerShell : A Match Made in Heaven
Webinar - Office 365 & PowerShell : A Match Made in HeavenWebinar - Office 365 & PowerShell : A Match Made in Heaven
Webinar - Office 365 & PowerShell : A Match Made in HeavenSébastien Levert
 

Similar to SPSTC - PowerShell - Through the SharePoint Looking Glass (20)

SPO Migration - New API
SPO Migration - New APISPO Migration - New API
SPO Migration - New API
 
Power Shell and Sharepoint 2013
Power Shell and Sharepoint 2013Power Shell and Sharepoint 2013
Power Shell and Sharepoint 2013
 
Operacion Guinda 2
Operacion Guinda 2Operacion Guinda 2
Operacion Guinda 2
 
PowerShell Basics for Office Apps and Servers
PowerShell Basics for Office Apps and ServersPowerShell Basics for Office Apps and Servers
PowerShell Basics for Office Apps and Servers
 
ASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin LauASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin Lau
 
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
SPugPt Meeting 35: Manage govern and drive adoption of share point online wit...
 
Powershell to the People #suguk
Powershell to the People #sugukPowershell to the People #suguk
Powershell to the People #suguk
 
Automating OSD and Post-OSD Configuration with Powershell and Orchestrator
Automating OSD and Post-OSD Configuration with Powershell and OrchestratorAutomating OSD and Post-OSD Configuration with Powershell and Orchestrator
Automating OSD and Post-OSD Configuration with Powershell and Orchestrator
 
Office 365 & PowerShell - A match made in heaven
Office 365 & PowerShell - A match made in heavenOffice 365 & PowerShell - A match made in heaven
Office 365 & PowerShell - A match made in heaven
 
The Path through SharePoint Migrations
The Path through SharePoint MigrationsThe Path through SharePoint Migrations
The Path through SharePoint Migrations
 
[Vončina] Configuring SharePoint 2016 for BI Scenarios
[Vončina] Configuring SharePoint 2016 for BI Scenarios[Vončina] Configuring SharePoint 2016 for BI Scenarios
[Vončina] Configuring SharePoint 2016 for BI Scenarios
 
Share point hosted add ins munich
Share point hosted add ins munichShare point hosted add ins munich
Share point hosted add ins munich
 
The Path Through SharePoint Migrations
The Path Through SharePoint MigrationsThe Path Through SharePoint Migrations
The Path Through SharePoint Migrations
 
The Power of Document Generation with Nintex
The Power of Document Generation with NintexThe Power of Document Generation with Nintex
The Power of Document Generation with Nintex
 
WinOps Conf 2016 - Michael Greene - Release Pipelines
WinOps Conf 2016 - Michael Greene - Release PipelinesWinOps Conf 2016 - Michael Greene - Release Pipelines
WinOps Conf 2016 - Michael Greene - Release Pipelines
 
An Introduction to the Office 365 Patterns and Practices Project
An Introduction to the Office 365 Patterns and Practices ProjectAn Introduction to the Office 365 Patterns and Practices Project
An Introduction to the Office 365 Patterns and Practices Project
 
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...
 
Access Apps for Office 365 with Power BI
Access Apps for Office 365 with Power BIAccess Apps for Office 365 with Power BI
Access Apps for Office 365 with Power BI
 
Build Your First SharePoint Framework Webpart
Build Your First SharePoint Framework WebpartBuild Your First SharePoint Framework Webpart
Build Your First SharePoint Framework Webpart
 
Webinar - Office 365 & PowerShell : A Match Made in Heaven
Webinar - Office 365 & PowerShell : A Match Made in HeavenWebinar - Office 365 & PowerShell : A Match Made in Heaven
Webinar - Office 365 & PowerShell : A Match Made in Heaven
 

More from Brian Caauwe

SPSLA - What to Expect with SharePoint 2019
SPSLA - What to Expect with SharePoint 2019SPSLA - What to Expect with SharePoint 2019
SPSLA - What to Expect with SharePoint 2019Brian Caauwe
 
WISPUG - Fun with SharePoint Migrations
WISPUG - Fun with SharePoint MigrationsWISPUG - Fun with SharePoint Migrations
WISPUG - Fun with SharePoint MigrationsBrian Caauwe
 
SPSSTL - Understanding the Collaboration Toolkit
SPSSTL - Understanding the Collaboration Toolkit SPSSTL - Understanding the Collaboration Toolkit
SPSSTL - Understanding the Collaboration Toolkit Brian Caauwe
 
SPSSTL - Content Management Internals
SPSSTL - Content Management Internals SPSSTL - Content Management Internals
SPSSTL - Content Management Internals Brian Caauwe
 
SPSSTL - Building Search Driven Applications
SPSSTL - Building Search Driven ApplicationsSPSSTL - Building Search Driven Applications
SPSSTL - Building Search Driven ApplicationsBrian Caauwe
 
Building Search Driven Applications
Building Search Driven ApplicationsBuilding Search Driven Applications
Building Search Driven ApplicationsBrian Caauwe
 
Demystifying Workflow
Demystifying WorkflowDemystifying Workflow
Demystifying WorkflowBrian Caauwe
 

More from Brian Caauwe (7)

SPSLA - What to Expect with SharePoint 2019
SPSLA - What to Expect with SharePoint 2019SPSLA - What to Expect with SharePoint 2019
SPSLA - What to Expect with SharePoint 2019
 
WISPUG - Fun with SharePoint Migrations
WISPUG - Fun with SharePoint MigrationsWISPUG - Fun with SharePoint Migrations
WISPUG - Fun with SharePoint Migrations
 
SPSSTL - Understanding the Collaboration Toolkit
SPSSTL - Understanding the Collaboration Toolkit SPSSTL - Understanding the Collaboration Toolkit
SPSSTL - Understanding the Collaboration Toolkit
 
SPSSTL - Content Management Internals
SPSSTL - Content Management Internals SPSSTL - Content Management Internals
SPSSTL - Content Management Internals
 
SPSSTL - Building Search Driven Applications
SPSSTL - Building Search Driven ApplicationsSPSSTL - Building Search Driven Applications
SPSSTL - Building Search Driven Applications
 
Building Search Driven Applications
Building Search Driven ApplicationsBuilding Search Driven Applications
Building Search Driven Applications
 
Demystifying Workflow
Demystifying WorkflowDemystifying Workflow
Demystifying Workflow
 

Recently uploaded

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 

Recently uploaded (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 

SPSTC - PowerShell - Through the SharePoint Looking Glass

  • 1. PowerShell: Through the SharePoint Looking Glass Brian Caauwe @bcaauwe April 14th, 2018
  • 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
  • 6.
  • 11. • ALWAYS run “As Administrator” • Uses powershell.exe under Windowssystem32 • Microsoft.SharePoint.Powershell snap-in – C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions15[6]CONFIGPOWERSHELLRegistrationsharepoint.ps1 • Sets ExecutionPolicy to RemoteSigned • 700+ Cmdlets – SharePoint 2013 • 800+ Cmdlets – SharePoint 2016 Management Shell On-Premise
  • 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
  • 15. • Call PowerShell from Windowssystem32 • Register Microsoft.SharePoint.Powershell snap-in -psconsolefile “C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions15[6]CONFIGPOWERSHELL Registrationpsconsole.psc1” • Call Script -command “E:PowerShellSet-ScriptName.ps1” • Logging Scheduled Tasks
  • 16. Memory Leaks • Disposable Objects $web.Dispose() $site.Dispose() • SPAssignment – Garbage Collector Global Start-SPAssignment -Global Get-SPSite –Limit All | Get-SPWeb | Select Url, WebTemplate, WebTemplateId Stop-SPAssignment -Global Scoped $w = Get-SPWebApplication http://www.company.com $siteScope = Start-SPAssignment foreach ($site in ($siteScope | Get-SPSite -Limit All –WebApplication $)) { $webScope = Start-SPAssignment foreach ($web in ($webScope | Get-SPWeb -Limit All -Site $site)) { ## Do Something } Stop-SPAssignment $webScope } Stop-SPAssignment $siteScope
  • 17. • Other Assemblies • IIS (WebAdministration) • SQL • Exchange • User Profile • Microsoft.Office.Server.UserProfiles • Managed Metadata • Microsoft.SharePoint.Taxonomy
  • 19. • High Level Cmdlets • Get-SPWebApplication • Get-SPSite • Get-SPWeb Day-to-Day $w = Get-SPWebApplication http://my.company.com $site = Get-SPSite http://my.company.com $site | Get-SPWeb -Limit All
  • 20. • Will utilize Log Cmdlets • New-SPLogFile • Merge-SPLogFile Troubleshooting New-SPLogFile Merge-SPLogFile –Path “C:Debugerror.log” –Correlation 470a4ec2-985d-43be-a14e-176eb1c39672
  • 21. • Will utilize SPSolution Cmdlets • Add-SPSolution • Get-SPSolution • Install-SPSolution Customizations Add-SPSolution –LiteralPath “C:Solutionsspcmis.wsp” $sol = Get-SPSolution | ?{$_.Name –eq “spcmis.wsp”} $sol | Install-SPSolution –GACDeployment –AllWebApplications –Compatibilitylevel All
  • 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
  • 26. • Utilize Cmdlet • Connect-SPOService Connecting Connect-SPOService –url https://tenant-admin.sharepoint.com
  • 27. • Limited Cmdlets • Get/Set-SPOSite • Get/Set/Remove-SPOUser Day-to-Day $site = Get-SPSite https://[tenant].sharepoint.com Set-SPOUser -LoginName user@email.com -Site $site -IsSiteCollectionAdmin $true
  • 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()
  • 31. $creds = New-Object System.Management.Automation.PSCredential “user@email.com”, (ConvertTo-SecureString “pass@word1” -AsPlainText -force) Connect-PnPOnline –Url $url –Credentials $creds $ctx = Get-PnPContext $ctx.RequestTimeout = [System.Threading.Timeout]::Infinite $root = Get-PnPWeb Starts with the Connect-PnPOnline Revolves around PnPContext PnP PowerShell
  • 32. $provisioningList = Get-PnPList -Identity $listName $query = "<View><Query><Where><Eq><FieldRef Name='Status'></FieldRef><Value Type='Text'>Submitted</Value></Eq></Where></Query></View>" $items = Get-PnPListItem -List $provisioningList -Query $query Set-PnPListItem -List "Provisioning List" -Identity $item.Id -Values @{"Status"="In Progress";"StatusDescription"="Starting site creation process"} New-PnPGroup -Title $ownerGroupName -Owner $siteOwner.Email Get-PnPGroup -AssociatedOwnerGroup -Web $web Set-PnPGroup -Identity $ownersGroup -SetAssociatedGroup Owners Set-PnPGroupPermissions -Identity $ownersGroup -AddRole "Full Control“ Add-PnPUserToGroup -LoginName $siteOwner.Email -Identity $ownersGroup Wraps CSOM methods and objects New-PnPTenantSite -Title $item.Title -Url $siteLocation -Owner $siteOwner.Email -TimeZone 11 -Description $siteDescription -Template $siteTemplate –Wait New-PnPWeb -Title $item.Title -Url $webLocation -Template $siteTemplate -Web $parentWeb -Locale 1033 -BreakInheritance PnP PowerShell
  • 34. Questions Please give me feedback https://guidebook.com/guide/123531/event/18208880
  • 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

  1. You won’t learn by books or sessions Find YOUR practical applications
  2. Use Get-Help for information on Cmdlets Full property for verbose information Examples for… Examples