PowerShell with SharePoint 2013 and Office 365

45
PowerShell with SharePoint 2013 and Office 365 Jerry Yasir, www.NetComLearning.com SharePoint Server MVP, MCT MCSE SharePoint 2013, MCSA 2012

description

PowerShell with SharePoint 2013 and Office 365. Jerry Yasir , www.NetComLearning.com SharePoint Server MVP , MCT MCSE SharePoint 2013, MCSA 2012. Agenda. SharePoint and PowerShell Basics Managing Web Applications and Site Collections Upgrading SharePoint Managing Apps with PowerShell - PowerPoint PPT Presentation

Transcript of PowerShell with SharePoint 2013 and Office 365

Page 1: PowerShell with SharePoint 2013 and Office 365

PowerShell with SharePoint 2013 and Office 365Jerry Yasir, www.NetComLearning.comSharePoint Server MVP, MCTMCSE SharePoint 2013, MCSA 2012

Page 2: PowerShell with SharePoint 2013 and Office 365

AgendaSharePoint and PowerShell BasicsManaging Web Applications and Site CollectionsUpgrading SharePointManaging Apps with PowerShellManaging Office 365 & SharePoint Online

Page 3: PowerShell with SharePoint 2013 and Office 365

PowerShell and SharePoint Basics

Page 4: PowerShell with SharePoint 2013 and Office 365

• PowerShell does not Load SharePoint cmdLets

• First Add SharePoint SnapIn to Load SharePoint cmdLets

Add PowerShell Snap-In to PowerShell

Page 5: PowerShell with SharePoint 2013 and Office 365

Working with SharePoint Objects

Page 6: PowerShell with SharePoint 2013 and Office 365

• Creating Site Collections and Sites• Moving Site Collections• Restoring Site Collection• Creating Web Applications• Working with Services• Managing Service Applications

Working with SharePoint Objects

Page 7: PowerShell with SharePoint 2013 and Office 365

Upgrade to SharePoint 2013

Page 8: PowerShell with SharePoint 2013 and Office 365

Getting Ready for UpgradeTest-SPContentDatabase & Mount-SPContentDatabaseDeferred Site Collection Upgrade = New cmdletsManaging solutions in 14 / 15 hiveTest-SPContentDatabase –Name Wss_Content –WebApplication http://servername

Mount-SPContentDatabase –Name Wss_Content –WebApplication http://servername

Page 9: PowerShell with SharePoint 2013 and Office 365

Content Database Upgrade

Page 10: PowerShell with SharePoint 2013 and Office 365

Solution ManagementNo Change with same commandsAdd-SPSolutionInstall-SPSolutionActivates solution for web application(s)-CompatibilityLevel (14, 15) – Installs solution to 14 / 15 hive

Add-SPSolution –LiteralPath C:\solution.wsp

Install-SPSolution -Identity solution.wsp -GACDeployment -CompatibilityLevel 15

Page 11: PowerShell with SharePoint 2013 and Office 365

Deferred Site Collection UpgradesCmdlets to:Manage Health ChecksUpgradeRequest Evaluation Site CollectionsCopy

View upgrade status with Get-SPSite

Page 12: PowerShell with SharePoint 2013 and Office 365

Site Collection Health ChecksTest-SPSiteRuns Site Collection Health ChecksAll rules by default or specify specific rule

Repair-SPSiteAutomatically repairs all issues

Test-SPSite –Identity http://server/sitecollection

Repair-SPSite –Identity http://server/sitecollection

Page 13: PowerShell with SharePoint 2013 and Office 365

Upgrading Site CollectionsUpgrade-SPSiteStarts Upgrade Process on Site CollectionAlso resumes failed upgrades-Unthrottled – bypasses throttle limits-VersionUpgrade – used to upgrade from version 14

Upgrade-SPSite http://server/sitecollection -VersionUpgrade

Page 14: PowerShell with SharePoint 2013 and Office 365

Monitoring Upgrade StatusGet-SPSiteUpgradeSessionReports upgrade status for content db and site collectionUse with -ContentDatabase or -Site

Content Database requires a filter parameter:-HideWaiting-ShowCompleted-ShowFailed-ShowInProgressGet-SPSiteUpgradeSession –Site http://server/sitecolection

$database = Get-SPContentDatabase MyContentDbGet-SPSiteUpgradeSession –ContentDatabase $database -ShowInProgress

Page 15: PowerShell with SharePoint 2013 and Office 365

Upgrade Evaluation Site CollectionsRequest-SPUpgradeEvaluationSiteRequests an upgrade evaluation site collectionTarget URL auto-generated-Email – specify whether site collection owner and farm admin receive notification

Request-SPUpgradeEvaluationSite http://server/sitecollection

Page 16: PowerShell with SharePoint 2013 and Office 365

Copying Site CollectionsCopy-SPSiteCopies a site collection to a new URL-Identity – source URL-TargetUrl – destination URL-DestinationDatabase (optional) – name of new database

Copy-SPSite http://server/sitecollection -DestinationDatabase MyContentDb -TargetUrl http://server/sitecollection2

Page 17: PowerShell with SharePoint 2013 and Office 365

Site Collection Upgrade

Page 18: PowerShell with SharePoint 2013 and Office 365

Service Applications

Page 19: PowerShell with SharePoint 2013 and Office 365

Automating ProvisioningMost Service Applications deployed by:Creating a ServiceCreating a Proxy

Parameters vary by applicationService Application NameDatabaseApplication Pool

Most SAs take time to provision

Page 20: PowerShell with SharePoint 2013 and Office 365

TranslationProvides translation capability with Bing TranslationNew-SPTranslationServiceApplication –Name TranslationService -ApplicationPool “SharePoint Web Services Default” –DatabaseServer MyDatabaseServer –DatabaseName TranslationServiceDatabase

New-SPTranslationServiceApplicationProxy –Name TranslationServiceProxy –ServiceApplication TranslationService –DefaultProxyGroup

Page 21: PowerShell with SharePoint 2013 and Office 365

Work Management ServiceProvides aggregation between SharePoint, Exchange, and ProjectNew-SPWorkManagementServiceApplication –Name "WM Service App" -ApplicationPool “SharePoint Web Services Default”

New-SPWorkManagementServiceApplicationProxy -name "WMServiceProxy" -ServiceApplication “WM Service App”

Page 22: PowerShell with SharePoint 2013 and Office 365

Services ProvisioningYou need to Provision the Services from Services on Server Page$ExcelService = Get-SPServiceInstance | Where TypeName -like "Excel*"$ExcelService.Provision() Windows 7

Page 23: PowerShell with SharePoint 2013 and Office 365

Provisioning Service Applications and Service Instances

Page 24: PowerShell with SharePoint 2013 and Office 365

Managing Apps

Page 25: PowerShell with SharePoint 2013 and Office 365

PowerShell – App TerminologyAppPackage – physical file containing the app (.app)App – instance of an app on a given subsite.Id propery used often in cmdlets

Page 26: PowerShell with SharePoint 2013 and Office 365

Installing Apps with PowerShellImport-SPAppPackage – imports app package-Path – location of .app file-Site – URL of site collection-Source – MarketPlace / ObjectModel / CorporateCatalog / DeveloperSite

Install-SPApp – installs instance of an app-Identity – app object-Web – URL to the site

$spapppack = Import-SPAppPackage -Path .\myapp.app -Site http://dev.adventure.com -Source ObjectModel

$appinstance = Install-SPApp -Web http://dev.adventure.com -Identity $spapppack

Page 27: PowerShell with SharePoint 2013 and Office 365

Exporting Apps with PowerShellGet-SPAppInstance – returns an instance of an app-Identity – app instance-Web – URL of site

Export-SPAppPackage – exports app package from content db-App – id of app-Path – path of exported file$appinstance = Get-SPAppInstance –Web http://dev.adventure.com | Where-Object { $_.Title -eq “AppTitle" }

Export-SPAppPackage –App $appinstance.App –Path .\myexportedapp.app

Page 28: PowerShell with SharePoint 2013 and Office 365

Uninstalling & Updating AppsUpdate-SPAppInstance – updates an instance of an appUninstall-SPAppInstance – removes an instance of an appGet a reference to the previous app instanceImport new App PackageUpdate app instance using new app package

$appInstance = Get-SPAppInstance -web http://dev.adventure.com | Where-Object { $_.Title -eq “AppTitle" }

$appv2 = Import-SPAppPackage -Path .\myapp-v2.app -Site http://dev.adventure.com -Source ObjectModel

Update-SPAppInstance – Identity $appInstance –App $appv2

#To Uninstall an App

Uninstall-SPAppInstance -Identity $app

Page 29: PowerShell with SharePoint 2013 and Office 365

Managing Apps with PowerShell

Page 30: PowerShell with SharePoint 2013 and Office 365

Office365 & SharePoint Online

Page 32: PowerShell with SharePoint 2013 and Office 365

Connecting to SharePoint OnlineConnect-SPOServiceConnects to SharePoint Online-Url – URL to SharePoint Online tenant administration

i.e.: https://mytenant-admin.sharepoint.com-Credential – complete username of a global administrator

i.e.: [email protected]

Connect-SPOService –Url https://mytenant-admin.sharepoint.com –Credential [email protected]

Page 33: PowerShell with SharePoint 2013 and Office 365

What commands are available?Get-Command –Module Microsoft.Online.SharePoint.PowerShell

Page 34: PowerShell with SharePoint 2013 and Office 365

Working with Site CollectionsGet-SPOSiteReturns one or more site collections-Identity (optional) – URL of site collection-Limit (optional) – number of site collections to return

Default 200, ALL can be used-Filter (optional) – server side filtering using { }

Used in lieu of –IdentityNote case sensitive operators (-like, -notlike, -eq, -ne)

-Detailed – Returns non-default properties such as CompatibilityLevel

Get-SPOSiteGet-SPOSite -Detailed

Get-SPOSite –Identity https://mytenant.sharepoint.com

Get-SPOSite –Filter {Url -like “*term*}

Page 35: PowerShell with SharePoint 2013 and Office 365

Creating new Site CollectionsNew-SPOSiteCreates a site collection-Url – full URL of new site collection-Owner – full user name of site owner

i.e.: [email protected] – in MB-Template (Optional) – i.e.: STS#0

Get-SPOWebTemplate – returns all installed site templates-Title (Optional) – name of site collection

New-SPOSite -Url https://mytenant.sharepoint.com/sites/mynewsite -Owner [email protected] -StorageQuota 1000 -Title "My new site collection“ –Template STS#0

Page 36: PowerShell with SharePoint 2013 and Office 365

Deleting Site CollectionsRemove-SPOSiteMoves site collection to recycle bin-Identity – URL of site collectionSupports –confirm and -NoWait

Remove-SPOSite –Identity http://mytenant.sharepoint.com/sites/sitename -NoWait

Page 37: PowerShell with SharePoint 2013 and Office 365

Restoring Site CollectionsRestore-SPODeletedSiteRestores a site collection from the recycle bin-Identity – URL of site collection

Restore-SPODeletedSite –Identity http://mytenant.sharepoint.com/sites/sitename -NoWait

Page 38: PowerShell with SharePoint 2013 and Office 365

Upgrading Site CollectionsTest-SPOSite-Identity – URL of site collection

Upgrade-SPOSite-Identity – URL of site collection-V2VUpgrade – Required to do a version upgrade-QueueOnly – only add the site collection to the upgrade queue

Test-SPOSite -Identity http://mytenant.sharepoint.com/sites/sitenameUpgrade-SPOSite -Identity http://mytenant.sharepoint.com/sites/sitename -V2VUpgrade

Page 39: PowerShell with SharePoint 2013 and Office 365

Working with UsersGet-SPOUser-Site – full URL of site collection-LoginName (Optional) – specific user account name

i.e.: [email protected]

Add-SPOUserAdds existing user to a SharePoint Group-Site – full URL of site collection-LoginName – specific user account name-Group – SharePoint group

Get-SPOUser -Site https://mytenant.sharepoint.com -LoginName [email protected] Add-SPOUser -Site https://mytenant.sharepoint.com -LoginName [email protected] -Group "Team Site Members“

Page 40: PowerShell with SharePoint 2013 and Office 365

PowerShell with Office 365 and SharePoint Online

Page 41: PowerShell with SharePoint 2013 and Office 365

ThanksStick around for Q & A

Page 42: PowerShell with SharePoint 2013 and Office 365

PowerShell 3.0 Courses

Automating Administration with Windows PowerShell (10961)• July 22nd DC, NYC & Live Online• September 16th DC, NYC & Live Online

Pre-requisites:• Previous Windows Server and Windows Client management knowledge and hands on

experience• Experience Installing and Configuring Windows Server into existing enterprise

environments, or as standalone installations.• Knowledge and experience of network adapter configuration, basic Active Directory

user administration, and basic disk configuration.

Locations: Attend in-class or Live Online Instructor-led• New York• Las Vegas (All Inclusive Travel Package)• Arlington VA

www.netcomlearning.com

Page 43: PowerShell with SharePoint 2013 and Office 365

MCSE: SharePoint

MCSE: SharePoint• 20331: Core Solutions of Microsoft SharePoint Server 2013 • 20332: Advanced Solutions of Microsoft SharePoint Server 2013

Upcoming Classes:• August 5th in NYC, DC & Live Online• August 26th in Las Vegas & Live Online

** Contact Netcom Learning for SharePoint 2010 Course Schedules

Locations: Attend in-class or Live Online Instructor-led• New York• Las Vegas (All Inclusive Travel Package)• Arlington VA• Philadelphia, PA

www.netcomlearning.com

Page 44: PowerShell with SharePoint 2013 and Office 365

MCSD: SharePoint Developer

MCSD: SharePoint Developer• 20488: Developing Microsoft SharePoint Server 2013 Core Solutions• 20489: Developing Microsoft SharePoint Server 2013 Advanced Solutions

Upcoming Classes:• September 23rd in NYC, DC & Live Online• October 7th in Las Vegas & Live Online (All Inclusive Travel Package)

Locations: Attend in-class or Live Online Instructor-led• New York• Las Vegas (All Inclusive Travel Package)• Arlington VA

www.netcomlearning.com