How to do everything with PowerShell

Juan Carlos Gonzalez
Juan Carlos GonzalezMicrosoft 365 Apps & Services MVP | Microsoft 365 SME at CompartiMOSS
How to do everything with
PowerShell
Juan Carlos González
September 26th, 2015
Barcelona
Thanks to our Sponsors
Get stamps from all the sponsors
Deposit the passport to enter
the prize raffle
Good luck!
The SPSBCN Passport
FREE BEER!
Get your ticket at the registration
desk
Network and have fun with your
colleagues!
SharePint sponsored by
Michael Collins Pub
Plaça de Sagrada
Família
Starts at 19:30h
They help us improve
for SharePoint Saturday
2016!
Remember to fill your evaluation forms
Juan Carlos González
 Office 365 MVP
 Cloud & Productivity Advisor at MVP CLUSTER
 SUGES, Comunidad de O365 & Nuberos.Net coordinator
 CompartiMOSS Co-Director (www.compartimoss.com)
 Some ways to contact me:
 Twitter: jcgm1978
 LinkedIn: https://nl.linkedin.com/in/juagon
 Contact E-Mails:
 jcgonzalezmartin1978@Hotmail.com
 juancarlos.gonzalez@fiveshareit.es
 Blog: https://jcgonzalezmartin.wordpress.com/
 MVP CLUSTER Web Site: www.mvpcluster.com
Agenda
Default PowerShell
cmdlets
PowerShell for SharePoint possibilities
 What can I do with PowerShell for SharePoint?
Backup &
Restore
Operations
PowerShell provides several ways to interact and
work with SharePoint (OnPrem & Online)
Platform
Administration
Use Server
Side / Client
Side APIs
Troubleshooting
Everything !!!
PowerShell Development Environments
 SharePoint OnPremises – SharePoint Management
Shell:
 Available by default on every WFE / Application Server in a SharePoint Farm
 It provides access in the box to all the SharePoint cmdlets
PowerShell Development Environments
 SharePoint OnPremises – PowerShell Web Access:
PowerShell Development Environments
 SharePoint OnPremises – PowerShell Web Access:
 It provides a way to execute PowerShell cmdlets in the Browser
 In order to use it you have to:
 Enable PowerShell Web Access feature at the WFE(s) level
 Install/Enable PowerShell Web Access components using PowerShell
 Configure Default IIS Web Site on every SharePoint WFE(s) you want to use
PowerShell Web Access
Install-PswaWebApplication –UseTestCertificate
Add-PswaAuthorizationRule -UserName [Dominio][Usuario] -ComputerName
[NombreComputador] -ConfigurationName Microsoft.Powershell
PowerShell Development Environments
 SharePoint OnPremises y SPO – Windows
PowerShell:
 For SP OnPremises, the SharePoint Snap-In has to be loaded at first
PowerShell Development Environments
 SharePoint OnPremises y SPO – ISE:
PowerShell Development Environments
 PowerShell ISE:
 It’s “almost” a development environment for PowerShell providing features
such as Debugging Intellisense Code Coloring …
 Each new ISE version release adds new features and improvements
 It is a feature provided by default in Windows (Client and Server Editions),
although there are some cases you need to enable it (Windows Server 2008 R2)
 SharePoint Snap-In must be previously loaded in the ISE in order to be able
to use SharePoint OnPremises PowerShell cmdelts
 This step is not required for SPO
PowerShell Development Environments
 SharePoint OnPremises y SPO – Visual Studio:
PowerShell Development Environments
 SharePoint OnPremises y SPO – Visual Studio:
 PowerShell support in Visual Studio is provided by means of the PowerShell
Tools for Visual Studio:
 https://visualstudiogallery.msdn.microsoft.com/c9eb3ba8-0c59-4944-9a62-
6eee37294597
 Some features provided by PowerShell Tools for Visual Studio are:
 Create projects for PowerShell scripts and modules
 Execute PowerShell Scripts & Commands right from Visual Studio
 Edit, run and debug PowerShell scripts locally and remotely using the
Visual Studio debugger
 Leverage Visual Studio’s locals, watch, call stack, … for your scripts and
modules

PowerShell Development Environments
 SPO – SharePoint Online Management Shell:
 It provides a shortcut to SharePoint Online default cmdlets
 Updated quite often by Microsoft (last update available: August 2015)
PowerShell Development Environments
for SharePoint OnPremises and SPO
Default PowerShell Cmdlets
 Components of a PowerShell Cmdlet:
We can create
custom cmdlets
Default PowerShell Cmdlets
 SharePoint OnPremises:
 More tan 800 cmdlets in SharePoint 2013 SP 1 (861 cmdlets in SP 2016 IT
Preview)
Get-Command –PSSnapin "Microsoft.SharePoint.PowerShell"
Default PowerShell Cmdlets
 Example # 1 - Get-SPSite
 It allows to get all the Site Collections in the Farm that match the specified
conditions
 http://technet.microsoft.com/es-es/library/ff607950(v=office.15).aspx
Get-SPSite | select url, @{Expression={$_.Usage.Storage/1MB}}
Default PowerShell Cmdlets
 SharePoint Online:
 More than 40 cmdlets available for SPO (August 2015 update)
$spoCmdlets=Get-Command | where {$_.ModuleName -eq “Microsoft.Online.SharePoint.PowerShell"}
$spoCmdlets.Count
$spoCmdlets.Name
Default PowerShell Cmdlets
 Example # 1 - Get-SPOSite
 It allows to get all the Site Collections in a SharePoint Online tenant that match
the specified conditions
 https://technet.microsoft.com/es-es/library/FP161380.aspx
#Ejecución en la Consola de Administración de SharePoint Online
$sUserName="jcgonzalez@nuberosnet.onmicrosoft.com"
$sMessage="Introduce your SPO Credentials"
$sSPOAdminCenterUrl="https://nuberosnet-admin.sharepoint.com/"
$msolcred = Get-Credential -UserName $sUserName -Message $sMessage
Connect-SPOService -Url $sSPOAdminCenterUrl -Credential $msolcred
$spoSiteCollections=Get-SPOSite
Default PowerShell cmdlets for
SharePoint OnPremises and SPO
Using SharePoint APIs in PowerShell
 SharePoint Server Side API:
 SharePoint PowerShell Snap-In provides also access to the full server side API:
 You can use SharePoint objects in the same way you do in Visual Studio
 Example # 1 – How to create a SharePoint list and a add a column to the list:
$spSite=Get-SPSite -Identity $sSiteUrl
$spWeb=$spSite.OpenWeb()
$spWeb.Lists.Add("Lista Grande","Lista Grande",100)
$spFieldType = [Microsoft.SharePoint.SPFieldType]::Text
$spList = $spWeb.Lists["Lista Grande"]
$spList.Fields.Add(“Datos”,$spFieldType,$false)
$spList.Fields["Datos"].Update()
$spList.Update()
Using SharePoint APIs in PowerShell
 SharePoint Server Side API:
 Example # 2 – How to do a CAML Query:
$spSite=Get-SPSite -Identity $sSiteCollection
$spwWeb=$spSite.OpenWeb()
$splList = $spwWeb.Lists.TryGetList($sListName)
$spqQuery = New-Object Microsoft.SharePoint.SPQuery
$spqQuery.Query =
" <Where>
<Contains>
<FieldRef Name='FileLeafRef' />
<Value Type='File'>Farm</Value>
</Contains>
</Where>"
$spqQuery.ViewFields = "<FieldRef Name='FileLeafRef' /><FieldRef Name='Title' />"
$spqQuery.ViewFieldsOnly = $true
$splListItems = $splList.GetItems($spqQuery)
Using SharePoint APIs in PowerShell
 SharePoint Client Side API:
 Client Side API (better known as CSOM) can be used in PowerShell for both
SharePoint OnPremises and SPO
 First step before using the API is to load the required assemblies:
 Once the assemblies are loaded, simply follow CSOM rules
Add-Type -Path "<CSOM_Path>Microsoft.SharePoint.Client.dll"
Add-Type -Path "<CSOM_Path>Microsoft.SharePoint.Client.Runtime.dll"
Using SharePoint APIs in PowerShell
 SharePoint Client Side API:
 Example 1 – Using CSOM for SharePoint OnPremises in PowerShell:
#SharePoint Client Object Model Context
$spCtx = New-Object Microsoft.SharePoint.Client.ClientContext($sSiteColUrl)
$spCredentials = New-Object
System.Net.NetworkCredential($sUserName,$sPassword,$sDomain)
$spCtx.Credentials = $spCredentials
#Root Web Site
$spRootWebSite = $spCtx.Web
#Collecction of Sites under the Root Web Site
$spSites = $spRootWebSite.Webs
#Loading operations
$spCtx.Load($spRootWebSite)
$spCtx.Load($spSites)
$spCtx.ExecuteQuery()
Using SharePoint APIs in PowerShell
 SharePoint Client Side API:
 Example 2 – Using CSOM for SPO in PowerShell:
$spoCtx = New-Object Microsoft.SharePoint.Client.ClientContext($sSiteColUrl)
$spoCredentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($sUsername, $sPassword)
$spoCtx.Credentials = $spoCredentials
#Root Web Site
$spoRootWebSite = $spoCtx.Web
#Collecction of Sites under the Root Web Site
$spoSites = $spoRootWebSite.Webs
#Loading operations
$spoCtx.Load($spoRootWebSite)
$spoCtx.Load($spoSites)
$spoCtx.ExecuteQuery()
#We need to iterate through the $spoSites Object in order to get individual sites information
foreach($spoSite in $spoSites){
$spoCtx.Load($spoSite)
$spoCtx.ExecuteQuery()
Write-Host $spoSite.Title " - " $spoSite.Url -ForegroundColor Blue
}
Do you see the difference?
Using SharePoint APIs from PowerShell
PowerShell Usage Scenarios
Platform
Administration
There are several PowerShell usage scenarios in
SharePoint (OnPremises and Online)
SharePoint
Migrations
Auditing Tasks
(Farm / Tenant
Level)
Troubleshooting
Solutions
Deployment
PowerShell Usage Scenarios
 Installation & Configuration:
 PowerShell provides more control over the SharePoint installation &
configuration process in regards to:
 Installation Accounts Database Names Service Applications
Configuration …
 It takes some more time than the SharePoint visual installation, but you will get
two great benefits:
1) The configuration for all servers in the farm is the same
2) It’s a more advisable approach in terms of disaster recovery
 There are some good scripts that show how you can automate all the
installation and configuration of a SharePoint farm:
 AutoSPInstaller: http://autospinstaller.codeplex.com/
PowerShell Usage Scenarios
 Installation & Configuration:
Using
PowerShell
Side effects of a
Visual Installation
PowerShell Usage Scenarios
 Farm / Tenant Administration:
 A SharePoint Administrator can do more administration tasks using PowerShell
than using the SharePoint Central Administration
 For instance, the farm passphrase can only be changed by means of
PowerShell
Add-PSSnapin Microsoft.SharePoint.PowerShell
$passphrase = ConvertTo-SecureString –string “<NewPassword>” -asPlainText –Force
Set-SPPassPhrase -PassPhrase $passphrase -Confirm
PowerShell Usage Scenarios
 Farm / Tenant Administration:
 Example 2 – How to re-start all the timer service instances in a SharePoint farm:
$spFarm=Get-SPFarm
$spfTimerServcicesInstance=$spFarm.TimerService.Instances
foreach ($spfTimerServiceInstance in $spfTimerServcicesInstances)
{
Write-Host "Re-starting the instance " $spfTimerServiceInstance.TypeName
$spfTimerServiceInstance.Stop()
$spfTimerServiceInstance.Start()
Write-Host "SharePoint Timer Service Instance" $spfTimerServiceInstance.TypeName "Re-Started"
}
PowerShell Usage Scenarios
 SharePoint Migration & Upgrade scenarios:
 For SharePoint 2013 we have several PowerShell cmdlets for doing SharePoint
migration and upgrading tasks
• Content Databases level:
• Mount-SPContentDatabase
• Test-SPContentDatabase
• Upgrade-SPContentDatabase
• Site Collections level:
• Test-SPSite
• Repair-SPSite
• Upgrade-SPSite
• Request-
SPUpgradeEvaluationSiteCollection
• Farm level:
• Upgrade-SPFarm
• Queues Administration:
• Get-SPSiteUpgradeSession
• Remove-SPSiteUpgradeSession
• Service Applications level:
• New-SPBusinessDataCatalogServiceApplication
• Restore-SPEnterpriseSearchServiceApplication
• Upgrade-SPEnterpriseSearchServiceApplication
• Upgrade-
SPEnterpriseSearchServiceApplicationSiteSettin
gs
• New-SPMetadataServiceApplication
• New-SPPerformancePointServiceApplication
• New-SPProfileServiceApplication
• New-SPProjectServiceApplication
• New-New-SPSecureStoreApplication
• New-SPSubscriptionSettingsServiceApplication
PowerShell Usage Scenarios
 SharePoint Migration & Upgrade scenarios:
 Example – How to execute Test-SPContentDatabase in all the Content DBs in a
SharePoint 2010 / 2013 Farm:
$sServerInstance=“<Server_Instance>”
$spWebApps = Get-SPWebApplication -IncludeCentralAdministration
foreach($spWebApp in $spWebApps)
{
$ContentDatabases = $spWebApp.ContentDatabases
foreach($ContentDatabase in $ContentDatabases)
{
Test-SPContentDatabase –Name $ContentDatabase.Name -ServerInstance
$sServerInstance -WebApplication $spWebApp.Url
}
}
PowerShell Usage Scenarios
 Auditing SharePoint Environments:
 Through PowerShell you can do auditing tasks such as:
 Get detailed information about the logical and information architecture of a
farm: Web Applications Site Collections Sites Lists / Document Libraries …
 Get information about Content DB sizes, storage being used by Site
Collections and Sites
 Access to security information in the farm such as authentication methods in
use, SharePoint Groups and SharePoint Users defined in farm Site Collections
and Sites, Permissions levels, …
 Get all the customizations deployed and installed in the farm (.WSPs) + a list
of all the features available at different scopes
PowerShell Usage Scenarios
 SharePoint Auditing Environments:
 Example # 1 - How to get the size of all the Content DBs in a farm:
$spWebApps = Get-SPWebApplication -IncludeCentralAdministration
foreach($spWebApp in $spWebApps)
{
#$spWebApp.Name
$ContentDBs = $spWebApp.ContentDatabases
foreach($ContentDB in $ContentDBs)
{
$ContentDBsize = [Math]::Round(($ContentDB.disksizerequired/1GB),2)
$ContentDBInfo= $spWebApp.DisplayName + "," + $ContentDB.Name + ","
+ $ContentDBsize + " GB"
$ContentDBInfo
}
}
PowerShell Usage Scenarios
 SharePoint Auditing Environments:
 Example # 2 - How to extract all the WSPs deployed to a SharePoint farm:
$spFarm=Get-SPFarm
$spSolutions = $spFarm.Solutions
$iSolutionsNumber=0
foreach($spSolution in $spSolutions)
{
$spSolutionFile=$spSolution.SolutionFile
$spSolutionFile.SaveAs($ScriptDir + "" + $spSolution.DisplayName)
$iSolutionsNumber+=1
}
PowerShell Usage Scenarios
 Troubleshooting:
 Through specific cmdlets to deal with SharePoint LOGS:
PowerShell Usage Scenarios
 Troubleshooting:
 Example # 1 – Enable / Disable the Developer Dashboard:
$svc=[Microsoft.SharePoint.Administration.SPWebService]::ContentService
$ddsetting=$svc.DeveloperDashboardSettings
$ddsetting.DisplayLevel=[Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::On
$ddsetting.Update()
PowerShell Usage Scenarios
 Solutions deployment / Artifacts provisioning:
 Install & deploy SharePoint Solutions (.WSP)
 Enable /disable SharePoint features
 Apply recursively look & feel customizations to all the sites in a Site
Collection
 Artifacts provisioning to deploy a complete SharePoint solution by creating
Sites, Content Types, Site Columns, Lists, Document Libraries, …
 Office 365 PnP Provisioning Engine is a good example of how to automate the
provisioning of SharePoint artifacts
 https://github.com/OfficeDev/PnP-Provisioning-Schema/wiki
 https://github.com/jcgonzalezmartin/jcgonzalez
PowerShell Usage Scenarios for
SharePoint
Conclusions
 PowerShell for SharePoint is a tool not only for administration and configuration
stuff but also for Auditing Troubleshooting Solutions Deployment Use of the
SharePoint API
 We can work with PowerShell for SharePoint using different development
environments:
 SharePoint Administration Console PowerShell ISE Visual Studio Windows
PowerShell PowerShell Web Acces SPO Administration Console
 We have a bunch of PowerShell cmdlets for SharePoint OnPremises and SPO
 > 800 cmdlets for SharePoint OnPremises
 > 40 cmdlets for SPO
 …and we can create our custom cmdlets
 In addition to the default cmdlets, we can use SharePoint APIs in our PowerShell
scripts…so we can do everything with PowerShell 
Q & A Barcelona
Juan Carlos González
 Office 365 MVP
 Cloud & Productivity Advisor at MVP CLUSTER
 SUGES, Comunidad de O365 & Nuberos.Net coordinator
 CompartiMOSS Co-Director (www.compartimoss.com)
 Some ways to contact me:
 Twitter: jcgm1978
 LinkedIn: https://nl.linkedin.com/in/juagon
 Contact E-Mails:
 jcgonzalezmartin1978@Hotmail.com
 juancarlos.gonzalez@fiveshareit.es
 Blog: https://jcgonzalezmartin.wordpress.com/
 MVP CLUSTER Web Site: www.mvpcluster.com
1 of 47

Recommended

A Year in the Empire by
A Year in the EmpireA Year in the Empire
A Year in the EmpireWill Schroeder
3.9K views52 slides
PowerShell for Penetration Testers by
PowerShell for Penetration TestersPowerShell for Penetration Testers
PowerShell for Penetration TestersNikhil Mittal
36.2K views119 slides
Power on, Powershell by
Power on, PowershellPower on, Powershell
Power on, PowershellRoo7break
3.9K views38 slides
Building Better Backdoors with WMI - DerbyCon 2017 by
Building Better Backdoors with WMI - DerbyCon 2017Building Better Backdoors with WMI - DerbyCon 2017
Building Better Backdoors with WMI - DerbyCon 2017Alexander Polce Leary
4K views47 slides
Introduction To Windows Power Shell by
Introduction To Windows Power ShellIntroduction To Windows Power Shell
Introduction To Windows Power ShellMicrosoft TechNet
3K views24 slides
Power shell training by
Power shell trainingPower shell training
Power shell trainingDavid Brabant
1.1K views57 slides

More Related Content

What's hot

Gruntwork Executive Summary by
Gruntwork Executive SummaryGruntwork Executive Summary
Gruntwork Executive SummaryYevgeniy Brikman
10.4K views38 slides
Derbycon - Passing the Torch by
Derbycon - Passing the TorchDerbycon - Passing the Torch
Derbycon - Passing the TorchWill Schroeder
7.9K views56 slides
I Have the Power(View) by
I Have the Power(View)I Have the Power(View)
I Have the Power(View)Will Schroeder
20.8K views70 slides
Windows attacks - AT is the new black by
Windows attacks - AT is the new blackWindows attacks - AT is the new black
Windows attacks - AT is the new blackChris Gates
10.9K views76 slides
PowerShell-1 by
PowerShell-1PowerShell-1
PowerShell-1Saravanan G
1.1K views29 slides
Powershell Seminar @ ITWorx CuttingEdge Club by
Powershell Seminar @ ITWorx CuttingEdge ClubPowershell Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge ClubEssam Salah
2K views31 slides

What's hot(20)

Derbycon - Passing the Torch by Will Schroeder
Derbycon - Passing the TorchDerbycon - Passing the Torch
Derbycon - Passing the Torch
Will Schroeder7.9K views
I Have the Power(View) by Will Schroeder
I Have the Power(View)I Have the Power(View)
I Have the Power(View)
Will Schroeder20.8K views
Windows attacks - AT is the new black by Chris Gates
Windows attacks - AT is the new blackWindows attacks - AT is the new black
Windows attacks - AT is the new black
Chris Gates10.9K views
Powershell Seminar @ ITWorx CuttingEdge Club by Essam Salah
Powershell Seminar @ ITWorx CuttingEdge ClubPowershell Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge Club
Essam Salah2K views
A complete guide to Node.js by Prabin Silwal
A complete guide to Node.jsA complete guide to Node.js
A complete guide to Node.js
Prabin Silwal2.7K views
Basic commands for powershell : Configuring Windows PowerShell and working wi... by Hitesh Mohapatra
Basic commands for powershell : Configuring Windows PowerShell and working wi...Basic commands for powershell : Configuring Windows PowerShell and working wi...
Basic commands for powershell : Configuring Windows PowerShell and working wi...
Hitesh Mohapatra602 views
Lucio Grenzi - Building serverless applications on the Apache OpenWhisk platf... by Codemotion
Lucio Grenzi - Building serverless applications on the Apache OpenWhisk platf...Lucio Grenzi - Building serverless applications on the Apache OpenWhisk platf...
Lucio Grenzi - Building serverless applications on the Apache OpenWhisk platf...
Codemotion443 views
ruxc0n 2012 by mimeframe
ruxc0n 2012ruxc0n 2012
ruxc0n 2012
mimeframe49.3K views
Ansible v2 and Beyond (Ansible Hawai'i Meetup) by Timothy Appnel
Ansible v2 and Beyond (Ansible Hawai'i Meetup)Ansible v2 and Beyond (Ansible Hawai'i Meetup)
Ansible v2 and Beyond (Ansible Hawai'i Meetup)
Timothy Appnel1.4K views
Play Framework: async I/O with Java and Scala by Yevgeniy Brikman
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and Scala
Yevgeniy Brikman108.6K views
Securing Prometheus exporters using HashiCorp Vault by Bram Vogelaar
Securing Prometheus exporters using HashiCorp VaultSecuring Prometheus exporters using HashiCorp Vault
Securing Prometheus exporters using HashiCorp Vault
Bram Vogelaar397 views
Keybase Vault Auto-Unseal HashiTalks2020 by Bas Meijer
Keybase Vault Auto-Unseal HashiTalks2020Keybase Vault Auto-Unseal HashiTalks2020
Keybase Vault Auto-Unseal HashiTalks2020
Bas Meijer1.9K views
Container and microservices: a love story by Thomas Rossetto
Container and microservices: a love storyContainer and microservices: a love story
Container and microservices: a love story
Thomas Rossetto211 views
Ansible: How to Get More Sleep and Require Less Coffee by Sarah Z
Ansible: How to Get More Sleep and Require Less CoffeeAnsible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less Coffee
Sarah Z25.5K views
Beyond Breakpoints: A Tour of Dynamic Analysis by Fastly
Beyond Breakpoints: A Tour of Dynamic AnalysisBeyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic Analysis
Fastly347 views

Viewers also liked

Some PowerShell Goodies by
Some PowerShell GoodiesSome PowerShell Goodies
Some PowerShell GoodiesCybereason
2.1K views12 slides
[CB16] Invoke-Obfuscation: PowerShell obFUsk8tion Techniques & How To (Try To... by
[CB16] Invoke-Obfuscation: PowerShell obFUsk8tion Techniques & How To (Try To...[CB16] Invoke-Obfuscation: PowerShell obFUsk8tion Techniques & How To (Try To...
[CB16] Invoke-Obfuscation: PowerShell obFUsk8tion Techniques & How To (Try To...CODE BLUE
1.7K views156 slides
Gray Hat PowerShell - ShowMeCon 2015 by
Gray Hat PowerShell - ShowMeCon 2015Gray Hat PowerShell - ShowMeCon 2015
Gray Hat PowerShell - ShowMeCon 2015Ben Ten (0xA)
3.8K views43 slides
PowerShell for Cyber Warriors - Bsides Knoxville 2016 by
PowerShell for Cyber Warriors - Bsides Knoxville 2016PowerShell for Cyber Warriors - Bsides Knoxville 2016
PowerShell for Cyber Warriors - Bsides Knoxville 2016Russel Van Tuyl
3.9K views88 slides
PowerShell Plus v4.7 Overview by
PowerShell Plus v4.7 OverviewPowerShell Plus v4.7 Overview
PowerShell Plus v4.7 OverviewRichard Giles
6.5K views51 slides
Windows Server 2008 (PowerShell Scripting Uygulamaları) by
Windows Server 2008 (PowerShell Scripting Uygulamaları)Windows Server 2008 (PowerShell Scripting Uygulamaları)
Windows Server 2008 (PowerShell Scripting Uygulamaları)ÇözümPARK
1.4K views53 slides

Viewers also liked(20)

Some PowerShell Goodies by Cybereason
Some PowerShell GoodiesSome PowerShell Goodies
Some PowerShell Goodies
Cybereason2.1K views
[CB16] Invoke-Obfuscation: PowerShell obFUsk8tion Techniques & How To (Try To... by CODE BLUE
[CB16] Invoke-Obfuscation: PowerShell obFUsk8tion Techniques & How To (Try To...[CB16] Invoke-Obfuscation: PowerShell obFUsk8tion Techniques & How To (Try To...
[CB16] Invoke-Obfuscation: PowerShell obFUsk8tion Techniques & How To (Try To...
CODE BLUE1.7K views
Gray Hat PowerShell - ShowMeCon 2015 by Ben Ten (0xA)
Gray Hat PowerShell - ShowMeCon 2015Gray Hat PowerShell - ShowMeCon 2015
Gray Hat PowerShell - ShowMeCon 2015
Ben Ten (0xA)3.8K views
PowerShell for Cyber Warriors - Bsides Knoxville 2016 by Russel Van Tuyl
PowerShell for Cyber Warriors - Bsides Knoxville 2016PowerShell for Cyber Warriors - Bsides Knoxville 2016
PowerShell for Cyber Warriors - Bsides Knoxville 2016
Russel Van Tuyl3.9K views
PowerShell Plus v4.7 Overview by Richard Giles
PowerShell Plus v4.7 OverviewPowerShell Plus v4.7 Overview
PowerShell Plus v4.7 Overview
Richard Giles6.5K views
Windows Server 2008 (PowerShell Scripting Uygulamaları) by ÇözümPARK
Windows Server 2008 (PowerShell Scripting Uygulamaları)Windows Server 2008 (PowerShell Scripting Uygulamaları)
Windows Server 2008 (PowerShell Scripting Uygulamaları)
ÇözümPARK1.4K views
Better, Faster, Stronger! Boost Your Team-Based SharePoint Development Using ... by Richard Calderon
Better, Faster, Stronger! Boost Your Team-Based SharePoint Development Using ...Better, Faster, Stronger! Boost Your Team-Based SharePoint Development Using ...
Better, Faster, Stronger! Boost Your Team-Based SharePoint Development Using ...
Richard Calderon2.7K views
Office 365 & PowerShell - A match made in heaven by Sébastien Levert
Office 365 & PowerShell - A match made in heavenOffice 365 & PowerShell - A match made in heaven
Office 365 & PowerShell - A match made in heaven
Sébastien Levert2.1K views
Practical PowerShell Programming for Professional People - Extended Edition by Ben Ten (0xA)
Practical PowerShell Programming for Professional People - Extended EditionPractical PowerShell Programming for Professional People - Extended Edition
Practical PowerShell Programming for Professional People - Extended Edition
Ben Ten (0xA)3.5K views
PowerShell from *nix user perspective by Juraj Michálek
PowerShell from *nix user perspectivePowerShell from *nix user perspective
PowerShell from *nix user perspective
Juraj Michálek2K views
Managing Virtual Infrastructures With PowerShell by guesta849bc8b
Managing Virtual Infrastructures With PowerShellManaging Virtual Infrastructures With PowerShell
Managing Virtual Infrastructures With PowerShell
guesta849bc8b782 views
PowerShell 101 by Thomas Lee
PowerShell 101PowerShell 101
PowerShell 101
Thomas Lee1.8K views
Incorporating PowerShell into your Arsenal with PS>Attack by jaredhaight
Incorporating PowerShell into your Arsenal with PS>AttackIncorporating PowerShell into your Arsenal with PS>Attack
Incorporating PowerShell into your Arsenal with PS>Attack
jaredhaight848 views
Getting Started With PowerShell Scripting by Ravikanth Chaganti
Getting Started With PowerShell ScriptingGetting Started With PowerShell Scripting
Getting Started With PowerShell Scripting
Ravikanth Chaganti3.3K views
Windows - Having Its Ass Kicked by Puppet and PowerShell Since 2012 by Puppet
Windows - Having Its Ass Kicked by Puppet and PowerShell Since 2012Windows - Having Its Ass Kicked by Puppet and PowerShell Since 2012
Windows - Having Its Ass Kicked by Puppet and PowerShell Since 2012
Puppet8.4K views
Geek Sync | Using PowerShell with Python and SQL Server by IDERA Software
Geek Sync | Using PowerShell with Python and SQL ServerGeek Sync | Using PowerShell with Python and SQL Server
Geek Sync | Using PowerShell with Python and SQL Server
IDERA Software444 views
Practical PowerShell Programming for Professional People by Ben Ten (0xA)
Practical PowerShell Programming for Professional PeoplePractical PowerShell Programming for Professional People
Practical PowerShell Programming for Professional People
Ben Ten (0xA)3.8K views

Similar to How to do everything with PowerShell

SPugPt Meeting 35: Manage govern and drive adoption of share point online wit... by
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
494 views20 slides
O365Engage17 - Managing share point online end to-end with powershell by
O365Engage17 - Managing share point online end to-end with powershellO365Engage17 - Managing share point online end to-end with powershell
O365Engage17 - Managing share point online end to-end with powershellNCCOMMS
161 views47 slides
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience by
SharePoint PowerShell for the Admin and Developer - A Venn Diagram ExperienceSharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram ExperienceRicardo Wilkins
1.8K views29 slides
Introducción al SharePoint Framework SPFx by
Introducción al SharePoint Framework SPFxIntroducción al SharePoint Framework SPFx
Introducción al SharePoint Framework SPFxSUGES (SharePoint Users Group España)
285 views50 slides
NZ Code Camp 2011 PowerShell + SharePoint by
NZ Code Camp 2011 PowerShell + SharePointNZ Code Camp 2011 PowerShell + SharePoint
NZ Code Camp 2011 PowerShell + SharePointNick Hadlee
559 views30 slides
PHP on Windows by
PHP on WindowsPHP on Windows
PHP on Windowsguest60c7659
968 views44 slides

Similar to How to do everything with PowerShell(20)

O365Engage17 - Managing share point online end to-end with powershell by NCCOMMS
O365Engage17 - Managing share point online end to-end with powershellO365Engage17 - Managing share point online end to-end with powershell
O365Engage17 - Managing share point online end to-end with powershell
NCCOMMS161 views
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience by Ricardo Wilkins
SharePoint PowerShell for the Admin and Developer - A Venn Diagram ExperienceSharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
SharePoint PowerShell for the Admin and Developer - A Venn Diagram Experience
Ricardo Wilkins1.8K views
NZ Code Camp 2011 PowerShell + SharePoint by Nick Hadlee
NZ Code Camp 2011 PowerShell + SharePointNZ Code Camp 2011 PowerShell + SharePoint
NZ Code Camp 2011 PowerShell + SharePoint
Nick Hadlee559 views
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in... by Sébastien Levert
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 Levert1.3K views
PowerShell: Through the SharePoint Looking Glass by Brian Caauwe
PowerShell: Through the SharePoint Looking GlassPowerShell: Through the SharePoint Looking Glass
PowerShell: Through the SharePoint Looking Glass
Brian Caauwe914 views
Windows power shell for sharepoint online &amp; office 365 by Prashant Kumar Singh
Windows power shell for sharepoint online &amp; office 365Windows power shell for sharepoint online &amp; office 365
Windows power shell for sharepoint online &amp; office 365
Webinar - Office 365 & PowerShell : A Match Made in Heaven by Sébastien Levert
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
Sébastien Levert488 views
Operacion Guinda 2 by Red RADAR
Operacion Guinda 2Operacion Guinda 2
Operacion Guinda 2
Red RADAR427 views
PowerShell for SharePoint Developers by Boulos Dib
PowerShell for SharePoint DevelopersPowerShell for SharePoint Developers
PowerShell for SharePoint Developers
Boulos Dib1.1K views
SPSTC - PowerShell - Through the SharePoint Looking Glass by Brian Caauwe
SPSTC - PowerShell - Through the SharePoint Looking GlassSPSTC - PowerShell - Through the SharePoint Looking Glass
SPSTC - PowerShell - Through the SharePoint Looking Glass
Brian Caauwe133 views
2014 SharePoint Saturday Melbourne Apps or not to Apps by Gilles Pommier
2014 SharePoint Saturday Melbourne Apps or not to Apps2014 SharePoint Saturday Melbourne Apps or not to Apps
2014 SharePoint Saturday Melbourne Apps or not to Apps
Gilles Pommier756 views
SharePoint for the .NET Developer by John Calvert
SharePoint for the .NET DeveloperSharePoint for the .NET Developer
SharePoint for the .NET Developer
John Calvert2.7K views
SharePoint Fest Chicago 2015 - Anatomy of configuring provider hosted add-in... by Nik Patel
SharePoint Fest Chicago 2015  - Anatomy of configuring provider hosted add-in...SharePoint Fest Chicago 2015  - Anatomy of configuring provider hosted add-in...
SharePoint Fest Chicago 2015 - Anatomy of configuring provider hosted add-in...
Nik Patel18.5K views

More from Juan Carlos Gonzalez

Boost your Teams Meetings to the next level with Teams Premium by
Boost your Teams Meetings to the next level with Teams PremiumBoost your Teams Meetings to the next level with Teams Premium
Boost your Teams Meetings to the next level with Teams PremiumJuan Carlos Gonzalez
3 views53 slides
Stream en SharePoint en detalle by
Stream en SharePoint en detalle Stream en SharePoint en detalle
Stream en SharePoint en detalle Juan Carlos Gonzalez
23 views43 slides
Power Platform y Teams: ¿Qué platos tengo en mi menú? by
Power Platform y Teams: ¿Qué platos tengo en mi menú?Power Platform y Teams: ¿Qué platos tengo en mi menú?
Power Platform y Teams: ¿Qué platos tengo en mi menú?Juan Carlos Gonzalez
38 views36 slides
Digitaliza tus procesos de Aprobación con Approvals en Teams: ¿Qué hay de nue... by
Digitaliza tus procesos de Aprobación con Approvals en Teams: ¿Qué hay de nue...Digitaliza tus procesos de Aprobación con Approvals en Teams: ¿Qué hay de nue...
Digitaliza tus procesos de Aprobación con Approvals en Teams: ¿Qué hay de nue...Juan Carlos Gonzalez
33 views49 slides
Stream on SharePoint, an overview - JcGonzalez.pptx by
Stream on SharePoint, an overview - JcGonzalez.pptxStream on SharePoint, an overview - JcGonzalez.pptx
Stream on SharePoint, an overview - JcGonzalez.pptxJuan Carlos Gonzalez
145 views43 slides
Shared channels in Microsoft Teams, an overview by
Shared channels in Microsoft Teams, an overview Shared channels in Microsoft Teams, an overview
Shared channels in Microsoft Teams, an overview Juan Carlos Gonzalez
46 views33 slides

More from Juan Carlos Gonzalez(20)

Boost your Teams Meetings to the next level with Teams Premium by Juan Carlos Gonzalez
Boost your Teams Meetings to the next level with Teams PremiumBoost your Teams Meetings to the next level with Teams Premium
Boost your Teams Meetings to the next level with Teams Premium
Power Platform y Teams: ¿Qué platos tengo en mi menú? by Juan Carlos Gonzalez
Power Platform y Teams: ¿Qué platos tengo en mi menú?Power Platform y Teams: ¿Qué platos tengo en mi menú?
Power Platform y Teams: ¿Qué platos tengo en mi menú?
Digitaliza tus procesos de Aprobación con Approvals en Teams: ¿Qué hay de nue... by Juan Carlos Gonzalez
Digitaliza tus procesos de Aprobación con Approvals en Teams: ¿Qué hay de nue...Digitaliza tus procesos de Aprobación con Approvals en Teams: ¿Qué hay de nue...
Digitaliza tus procesos de Aprobación con Approvals en Teams: ¿Qué hay de nue...
Digitaliza tus Aprobaciones con Approvals en Teams - JcGonzalez .pptx by Juan Carlos Gonzalez
Digitaliza tus Aprobaciones con Approvals en Teams - JcGonzalez .pptxDigitaliza tus Aprobaciones con Approvals en Teams - JcGonzalez .pptx
Digitaliza tus Aprobaciones con Approvals en Teams - JcGonzalez .pptx
Microsoft 365 Chicago - Governing Microsoft Teams Meetings by Juan Carlos Gonzalez
Microsoft 365 Chicago - Governing Microsoft Teams MeetingsMicrosoft 365 Chicago - Governing Microsoft Teams Meetings
Microsoft 365 Chicago - Governing Microsoft Teams Meetings
Solicita y comparte actualizaciones con Updates en Teams by Juan Carlos Gonzalez
Solicita y comparte actualizaciones con Updates en TeamsSolicita y comparte actualizaciones con Updates en Teams
Solicita y comparte actualizaciones con Updates en Teams
Shared channels in Microsoft Teams, an overview - JcGonzalez.pptx by Juan Carlos Gonzalez
Shared channels in Microsoft Teams, an overview - JcGonzalez.pptxShared channels in Microsoft Teams, an overview - JcGonzalez.pptx
Shared channels in Microsoft Teams, an overview - JcGonzalez.pptx
Governing Microsoft Teams Meetings: What are my options? by Juan Carlos Gonzalez
Governing Microsoft Teams Meetings: What are my options?Governing Microsoft Teams Meetings: What are my options?
Governing Microsoft Teams Meetings: What are my options?
Power Platform y Teams: ¿Qué platos tengo en mi menú? by Juan Carlos Gonzalez
Power Platform y Teams: ¿Qué platos tengo en mi menú?Power Platform y Teams: ¿Qué platos tengo en mi menú?
Power Platform y Teams: ¿Qué platos tengo en mi menú?
Digitalize your Approval processes with approvals in Microsoft Teams by Juan Carlos Gonzalez
Digitalize your Approval processes with approvals in Microsoft TeamsDigitalize your Approval processes with approvals in Microsoft Teams
Digitalize your Approval processes with approvals in Microsoft Teams
Digitaliza tus Aprobaciones con Approvals en Microsoft Teams by Juan Carlos Gonzalez
Digitaliza tus Aprobaciones con Approvals en Microsoft TeamsDigitaliza tus Aprobaciones con Approvals en Microsoft Teams
Digitaliza tus Aprobaciones con Approvals en Microsoft Teams
Microsoft Lists o como crear aplicaciones a la velocidad de la luz para M365 ... by Juan Carlos Gonzalez
Microsoft Lists o como crear aplicaciones a la velocidad de la luz para M365 ...Microsoft Lists o como crear aplicaciones a la velocidad de la luz para M365 ...
Microsoft Lists o como crear aplicaciones a la velocidad de la luz para M365 ...
Microsoft Lists o como crear aplicaciones a la velocidad de la luz para M365 ... by Juan Carlos Gonzalez
Microsoft Lists o como crear aplicaciones a la velocidad de la luz para M365 ...Microsoft Lists o como crear aplicaciones a la velocidad de la luz para M365 ...
Microsoft Lists o como crear aplicaciones a la velocidad de la luz para M365 ...

Recently uploaded

TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc
11 views29 slides
Melek BEN MAHMOUD.pdf by
Melek BEN MAHMOUD.pdfMelek BEN MAHMOUD.pdf
Melek BEN MAHMOUD.pdfMelekBenMahmoud
14 views1 slide
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ... by
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...Jasper Oosterveld
19 views49 slides
Serverless computing with Google Cloud (2023-24) by
Serverless computing with Google Cloud (2023-24)Serverless computing with Google Cloud (2023-24)
Serverless computing with Google Cloud (2023-24)wesley chun
11 views33 slides
Five Things You SHOULD Know About Postman by
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About PostmanPostman
36 views43 slides
Voice Logger - Telephony Integration Solution at Aegis by
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at AegisNirmal Sharma
39 views1 slide

Recently uploaded(20)

TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by TrustArc
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc11 views
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ... by Jasper Oosterveld
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
Serverless computing with Google Cloud (2023-24) by wesley chun
Serverless computing with Google Cloud (2023-24)Serverless computing with Google Cloud (2023-24)
Serverless computing with Google Cloud (2023-24)
wesley chun11 views
Five Things You SHOULD Know About Postman by Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman36 views
Voice Logger - Telephony Integration Solution at Aegis by Nirmal Sharma
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at Aegis
Nirmal Sharma39 views
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson92 views
Piloting & Scaling Successfully With Microsoft Viva by Richard Harbridge
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft Viva
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors by sugiuralab
TouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective SensorsTouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective Sensors
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors
sugiuralab21 views
Unit 1_Lecture 2_Physical Design of IoT.pdf by StephenTec
Unit 1_Lecture 2_Physical Design of IoT.pdfUnit 1_Lecture 2_Physical Design of IoT.pdf
Unit 1_Lecture 2_Physical Design of IoT.pdf
StephenTec12 views
Igniting Next Level Productivity with AI-Infused Data Integration Workflows by Safe Software
Igniting Next Level Productivity with AI-Infused Data Integration Workflows Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Safe Software280 views
Future of AR - Facebook Presentation by ssuserb54b561
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook Presentation
ssuserb54b56115 views

How to do everything with PowerShell

  • 1. How to do everything with PowerShell Juan Carlos González September 26th, 2015 Barcelona
  • 2. Thanks to our Sponsors
  • 3. Get stamps from all the sponsors Deposit the passport to enter the prize raffle Good luck! The SPSBCN Passport
  • 4. FREE BEER! Get your ticket at the registration desk Network and have fun with your colleagues! SharePint sponsored by Michael Collins Pub Plaça de Sagrada Família Starts at 19:30h
  • 5. They help us improve for SharePoint Saturday 2016! Remember to fill your evaluation forms
  • 6. Juan Carlos González  Office 365 MVP  Cloud & Productivity Advisor at MVP CLUSTER  SUGES, Comunidad de O365 & Nuberos.Net coordinator  CompartiMOSS Co-Director (www.compartimoss.com)  Some ways to contact me:  Twitter: jcgm1978  LinkedIn: https://nl.linkedin.com/in/juagon  Contact E-Mails:  jcgonzalezmartin1978@Hotmail.com  juancarlos.gonzalez@fiveshareit.es  Blog: https://jcgonzalezmartin.wordpress.com/  MVP CLUSTER Web Site: www.mvpcluster.com
  • 8. PowerShell for SharePoint possibilities  What can I do with PowerShell for SharePoint? Backup & Restore Operations PowerShell provides several ways to interact and work with SharePoint (OnPrem & Online) Platform Administration Use Server Side / Client Side APIs Troubleshooting Everything !!!
  • 9. PowerShell Development Environments  SharePoint OnPremises – SharePoint Management Shell:  Available by default on every WFE / Application Server in a SharePoint Farm  It provides access in the box to all the SharePoint cmdlets
  • 10. PowerShell Development Environments  SharePoint OnPremises – PowerShell Web Access:
  • 11. PowerShell Development Environments  SharePoint OnPremises – PowerShell Web Access:  It provides a way to execute PowerShell cmdlets in the Browser  In order to use it you have to:  Enable PowerShell Web Access feature at the WFE(s) level  Install/Enable PowerShell Web Access components using PowerShell  Configure Default IIS Web Site on every SharePoint WFE(s) you want to use PowerShell Web Access Install-PswaWebApplication –UseTestCertificate Add-PswaAuthorizationRule -UserName [Dominio][Usuario] -ComputerName [NombreComputador] -ConfigurationName Microsoft.Powershell
  • 12. PowerShell Development Environments  SharePoint OnPremises y SPO – Windows PowerShell:  For SP OnPremises, the SharePoint Snap-In has to be loaded at first
  • 13. PowerShell Development Environments  SharePoint OnPremises y SPO – ISE:
  • 14. PowerShell Development Environments  PowerShell ISE:  It’s “almost” a development environment for PowerShell providing features such as Debugging Intellisense Code Coloring …  Each new ISE version release adds new features and improvements  It is a feature provided by default in Windows (Client and Server Editions), although there are some cases you need to enable it (Windows Server 2008 R2)  SharePoint Snap-In must be previously loaded in the ISE in order to be able to use SharePoint OnPremises PowerShell cmdelts  This step is not required for SPO
  • 15. PowerShell Development Environments  SharePoint OnPremises y SPO – Visual Studio:
  • 16. PowerShell Development Environments  SharePoint OnPremises y SPO – Visual Studio:  PowerShell support in Visual Studio is provided by means of the PowerShell Tools for Visual Studio:  https://visualstudiogallery.msdn.microsoft.com/c9eb3ba8-0c59-4944-9a62- 6eee37294597  Some features provided by PowerShell Tools for Visual Studio are:  Create projects for PowerShell scripts and modules  Execute PowerShell Scripts & Commands right from Visual Studio  Edit, run and debug PowerShell scripts locally and remotely using the Visual Studio debugger  Leverage Visual Studio’s locals, watch, call stack, … for your scripts and modules 
  • 17. PowerShell Development Environments  SPO – SharePoint Online Management Shell:  It provides a shortcut to SharePoint Online default cmdlets  Updated quite often by Microsoft (last update available: August 2015)
  • 18. PowerShell Development Environments for SharePoint OnPremises and SPO
  • 19. Default PowerShell Cmdlets  Components of a PowerShell Cmdlet: We can create custom cmdlets
  • 20. Default PowerShell Cmdlets  SharePoint OnPremises:  More tan 800 cmdlets in SharePoint 2013 SP 1 (861 cmdlets in SP 2016 IT Preview) Get-Command –PSSnapin "Microsoft.SharePoint.PowerShell"
  • 21. Default PowerShell Cmdlets  Example # 1 - Get-SPSite  It allows to get all the Site Collections in the Farm that match the specified conditions  http://technet.microsoft.com/es-es/library/ff607950(v=office.15).aspx Get-SPSite | select url, @{Expression={$_.Usage.Storage/1MB}}
  • 22. Default PowerShell Cmdlets  SharePoint Online:  More than 40 cmdlets available for SPO (August 2015 update) $spoCmdlets=Get-Command | where {$_.ModuleName -eq “Microsoft.Online.SharePoint.PowerShell"} $spoCmdlets.Count $spoCmdlets.Name
  • 23. Default PowerShell Cmdlets  Example # 1 - Get-SPOSite  It allows to get all the Site Collections in a SharePoint Online tenant that match the specified conditions  https://technet.microsoft.com/es-es/library/FP161380.aspx #Ejecución en la Consola de Administración de SharePoint Online $sUserName="jcgonzalez@nuberosnet.onmicrosoft.com" $sMessage="Introduce your SPO Credentials" $sSPOAdminCenterUrl="https://nuberosnet-admin.sharepoint.com/" $msolcred = Get-Credential -UserName $sUserName -Message $sMessage Connect-SPOService -Url $sSPOAdminCenterUrl -Credential $msolcred $spoSiteCollections=Get-SPOSite
  • 24. Default PowerShell cmdlets for SharePoint OnPremises and SPO
  • 25. Using SharePoint APIs in PowerShell  SharePoint Server Side API:  SharePoint PowerShell Snap-In provides also access to the full server side API:  You can use SharePoint objects in the same way you do in Visual Studio  Example # 1 – How to create a SharePoint list and a add a column to the list: $spSite=Get-SPSite -Identity $sSiteUrl $spWeb=$spSite.OpenWeb() $spWeb.Lists.Add("Lista Grande","Lista Grande",100) $spFieldType = [Microsoft.SharePoint.SPFieldType]::Text $spList = $spWeb.Lists["Lista Grande"] $spList.Fields.Add(“Datos”,$spFieldType,$false) $spList.Fields["Datos"].Update() $spList.Update()
  • 26. Using SharePoint APIs in PowerShell  SharePoint Server Side API:  Example # 2 – How to do a CAML Query: $spSite=Get-SPSite -Identity $sSiteCollection $spwWeb=$spSite.OpenWeb() $splList = $spwWeb.Lists.TryGetList($sListName) $spqQuery = New-Object Microsoft.SharePoint.SPQuery $spqQuery.Query = " <Where> <Contains> <FieldRef Name='FileLeafRef' /> <Value Type='File'>Farm</Value> </Contains> </Where>" $spqQuery.ViewFields = "<FieldRef Name='FileLeafRef' /><FieldRef Name='Title' />" $spqQuery.ViewFieldsOnly = $true $splListItems = $splList.GetItems($spqQuery)
  • 27. Using SharePoint APIs in PowerShell  SharePoint Client Side API:  Client Side API (better known as CSOM) can be used in PowerShell for both SharePoint OnPremises and SPO  First step before using the API is to load the required assemblies:  Once the assemblies are loaded, simply follow CSOM rules Add-Type -Path "<CSOM_Path>Microsoft.SharePoint.Client.dll" Add-Type -Path "<CSOM_Path>Microsoft.SharePoint.Client.Runtime.dll"
  • 28. Using SharePoint APIs in PowerShell  SharePoint Client Side API:  Example 1 – Using CSOM for SharePoint OnPremises in PowerShell: #SharePoint Client Object Model Context $spCtx = New-Object Microsoft.SharePoint.Client.ClientContext($sSiteColUrl) $spCredentials = New-Object System.Net.NetworkCredential($sUserName,$sPassword,$sDomain) $spCtx.Credentials = $spCredentials #Root Web Site $spRootWebSite = $spCtx.Web #Collecction of Sites under the Root Web Site $spSites = $spRootWebSite.Webs #Loading operations $spCtx.Load($spRootWebSite) $spCtx.Load($spSites) $spCtx.ExecuteQuery()
  • 29. Using SharePoint APIs in PowerShell  SharePoint Client Side API:  Example 2 – Using CSOM for SPO in PowerShell: $spoCtx = New-Object Microsoft.SharePoint.Client.ClientContext($sSiteColUrl) $spoCredentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($sUsername, $sPassword) $spoCtx.Credentials = $spoCredentials #Root Web Site $spoRootWebSite = $spoCtx.Web #Collecction of Sites under the Root Web Site $spoSites = $spoRootWebSite.Webs #Loading operations $spoCtx.Load($spoRootWebSite) $spoCtx.Load($spoSites) $spoCtx.ExecuteQuery() #We need to iterate through the $spoSites Object in order to get individual sites information foreach($spoSite in $spoSites){ $spoCtx.Load($spoSite) $spoCtx.ExecuteQuery() Write-Host $spoSite.Title " - " $spoSite.Url -ForegroundColor Blue } Do you see the difference?
  • 30. Using SharePoint APIs from PowerShell
  • 31. PowerShell Usage Scenarios Platform Administration There are several PowerShell usage scenarios in SharePoint (OnPremises and Online) SharePoint Migrations Auditing Tasks (Farm / Tenant Level) Troubleshooting Solutions Deployment
  • 32. PowerShell Usage Scenarios  Installation & Configuration:  PowerShell provides more control over the SharePoint installation & configuration process in regards to:  Installation Accounts Database Names Service Applications Configuration …  It takes some more time than the SharePoint visual installation, but you will get two great benefits: 1) The configuration for all servers in the farm is the same 2) It’s a more advisable approach in terms of disaster recovery  There are some good scripts that show how you can automate all the installation and configuration of a SharePoint farm:  AutoSPInstaller: http://autospinstaller.codeplex.com/
  • 33. PowerShell Usage Scenarios  Installation & Configuration: Using PowerShell Side effects of a Visual Installation
  • 34. PowerShell Usage Scenarios  Farm / Tenant Administration:  A SharePoint Administrator can do more administration tasks using PowerShell than using the SharePoint Central Administration  For instance, the farm passphrase can only be changed by means of PowerShell Add-PSSnapin Microsoft.SharePoint.PowerShell $passphrase = ConvertTo-SecureString –string “<NewPassword>” -asPlainText –Force Set-SPPassPhrase -PassPhrase $passphrase -Confirm
  • 35. PowerShell Usage Scenarios  Farm / Tenant Administration:  Example 2 – How to re-start all the timer service instances in a SharePoint farm: $spFarm=Get-SPFarm $spfTimerServcicesInstance=$spFarm.TimerService.Instances foreach ($spfTimerServiceInstance in $spfTimerServcicesInstances) { Write-Host "Re-starting the instance " $spfTimerServiceInstance.TypeName $spfTimerServiceInstance.Stop() $spfTimerServiceInstance.Start() Write-Host "SharePoint Timer Service Instance" $spfTimerServiceInstance.TypeName "Re-Started" }
  • 36. PowerShell Usage Scenarios  SharePoint Migration & Upgrade scenarios:  For SharePoint 2013 we have several PowerShell cmdlets for doing SharePoint migration and upgrading tasks • Content Databases level: • Mount-SPContentDatabase • Test-SPContentDatabase • Upgrade-SPContentDatabase • Site Collections level: • Test-SPSite • Repair-SPSite • Upgrade-SPSite • Request- SPUpgradeEvaluationSiteCollection • Farm level: • Upgrade-SPFarm • Queues Administration: • Get-SPSiteUpgradeSession • Remove-SPSiteUpgradeSession • Service Applications level: • New-SPBusinessDataCatalogServiceApplication • Restore-SPEnterpriseSearchServiceApplication • Upgrade-SPEnterpriseSearchServiceApplication • Upgrade- SPEnterpriseSearchServiceApplicationSiteSettin gs • New-SPMetadataServiceApplication • New-SPPerformancePointServiceApplication • New-SPProfileServiceApplication • New-SPProjectServiceApplication • New-New-SPSecureStoreApplication • New-SPSubscriptionSettingsServiceApplication
  • 37. PowerShell Usage Scenarios  SharePoint Migration & Upgrade scenarios:  Example – How to execute Test-SPContentDatabase in all the Content DBs in a SharePoint 2010 / 2013 Farm: $sServerInstance=“<Server_Instance>” $spWebApps = Get-SPWebApplication -IncludeCentralAdministration foreach($spWebApp in $spWebApps) { $ContentDatabases = $spWebApp.ContentDatabases foreach($ContentDatabase in $ContentDatabases) { Test-SPContentDatabase –Name $ContentDatabase.Name -ServerInstance $sServerInstance -WebApplication $spWebApp.Url } }
  • 38. PowerShell Usage Scenarios  Auditing SharePoint Environments:  Through PowerShell you can do auditing tasks such as:  Get detailed information about the logical and information architecture of a farm: Web Applications Site Collections Sites Lists / Document Libraries …  Get information about Content DB sizes, storage being used by Site Collections and Sites  Access to security information in the farm such as authentication methods in use, SharePoint Groups and SharePoint Users defined in farm Site Collections and Sites, Permissions levels, …  Get all the customizations deployed and installed in the farm (.WSPs) + a list of all the features available at different scopes
  • 39. PowerShell Usage Scenarios  SharePoint Auditing Environments:  Example # 1 - How to get the size of all the Content DBs in a farm: $spWebApps = Get-SPWebApplication -IncludeCentralAdministration foreach($spWebApp in $spWebApps) { #$spWebApp.Name $ContentDBs = $spWebApp.ContentDatabases foreach($ContentDB in $ContentDBs) { $ContentDBsize = [Math]::Round(($ContentDB.disksizerequired/1GB),2) $ContentDBInfo= $spWebApp.DisplayName + "," + $ContentDB.Name + "," + $ContentDBsize + " GB" $ContentDBInfo } }
  • 40. PowerShell Usage Scenarios  SharePoint Auditing Environments:  Example # 2 - How to extract all the WSPs deployed to a SharePoint farm: $spFarm=Get-SPFarm $spSolutions = $spFarm.Solutions $iSolutionsNumber=0 foreach($spSolution in $spSolutions) { $spSolutionFile=$spSolution.SolutionFile $spSolutionFile.SaveAs($ScriptDir + "" + $spSolution.DisplayName) $iSolutionsNumber+=1 }
  • 41. PowerShell Usage Scenarios  Troubleshooting:  Through specific cmdlets to deal with SharePoint LOGS:
  • 42. PowerShell Usage Scenarios  Troubleshooting:  Example # 1 – Enable / Disable the Developer Dashboard: $svc=[Microsoft.SharePoint.Administration.SPWebService]::ContentService $ddsetting=$svc.DeveloperDashboardSettings $ddsetting.DisplayLevel=[Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::On $ddsetting.Update()
  • 43. PowerShell Usage Scenarios  Solutions deployment / Artifacts provisioning:  Install & deploy SharePoint Solutions (.WSP)  Enable /disable SharePoint features  Apply recursively look & feel customizations to all the sites in a Site Collection  Artifacts provisioning to deploy a complete SharePoint solution by creating Sites, Content Types, Site Columns, Lists, Document Libraries, …  Office 365 PnP Provisioning Engine is a good example of how to automate the provisioning of SharePoint artifacts  https://github.com/OfficeDev/PnP-Provisioning-Schema/wiki  https://github.com/jcgonzalezmartin/jcgonzalez
  • 44. PowerShell Usage Scenarios for SharePoint
  • 45. Conclusions  PowerShell for SharePoint is a tool not only for administration and configuration stuff but also for Auditing Troubleshooting Solutions Deployment Use of the SharePoint API  We can work with PowerShell for SharePoint using different development environments:  SharePoint Administration Console PowerShell ISE Visual Studio Windows PowerShell PowerShell Web Acces SPO Administration Console  We have a bunch of PowerShell cmdlets for SharePoint OnPremises and SPO  > 800 cmdlets for SharePoint OnPremises  > 40 cmdlets for SPO  …and we can create our custom cmdlets  In addition to the default cmdlets, we can use SharePoint APIs in our PowerShell scripts…so we can do everything with PowerShell 
  • 46. Q & A Barcelona
  • 47. Juan Carlos González  Office 365 MVP  Cloud & Productivity Advisor at MVP CLUSTER  SUGES, Comunidad de O365 & Nuberos.Net coordinator  CompartiMOSS Co-Director (www.compartimoss.com)  Some ways to contact me:  Twitter: jcgm1978  LinkedIn: https://nl.linkedin.com/in/juagon  Contact E-Mails:  jcgonzalezmartin1978@Hotmail.com  juancarlos.gonzalez@fiveshareit.es  Blog: https://jcgonzalezmartin.wordpress.com/  MVP CLUSTER Web Site: www.mvpcluster.com

Editor's Notes

  1. Template may not be modified Twitter hashtag: #spsbe for all sessions
  2. So first of all, thanks to the organization and thanks to all the sponsors for making possible this fantastic event
  3. Here you can see some of my community activities and also some of my contact details (contact e-mails, Twitter, LinkedInd)
  4. As I like to say on my trainings and conferences: everything!!!