PowerShell with SharePoint 2013 and Office 365Jerry Yasir, www.NetComLearning.comSharePoint Server MVP, MCTMCSE SharePoint 2013, MCSA 2012
AgendaSharePoint and PowerShell BasicsManaging Web Applications and Site CollectionsUpgrading SharePointManaging Apps with PowerShellManaging Office 365 & SharePoint Online
PowerShell and SharePoint Basics
• PowerShell does not Load SharePoint cmdLets
• First Add SharePoint SnapIn to Load SharePoint cmdLets
Add PowerShell Snap-In to PowerShell
Working with SharePoint Objects
• Creating Site Collections and Sites• Moving Site Collections• Restoring Site Collection• Creating Web Applications• Working with Services• Managing Service Applications
Working with SharePoint Objects
Upgrade to SharePoint 2013
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
Content Database Upgrade
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
Deferred Site Collection UpgradesCmdlets to:Manage Health ChecksUpgradeRequest Evaluation Site CollectionsCopy
View upgrade status with Get-SPSite
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
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
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
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
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
Site Collection Upgrade
Service Applications
Automating ProvisioningMost Service Applications deployed by:Creating a ServiceCreating a Proxy
Parameters vary by applicationService Application NameDatabaseApplication Pool
Most SAs take time to provision
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
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”
Services ProvisioningYou need to Provision the Services from Services on Server Page$ExcelService = Get-SPServiceInstance | Where TypeName -like "Excel*"$ExcelService.Provision() Windows 7
Provisioning Service Applications and Service Instances
Managing Apps
PowerShell – App TerminologyAppPackage – physical file containing the app (.app)App – instance of an app on a given subsite.Id propery used often in cmdlets
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
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
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
Managing Apps with PowerShell
Office365 & SharePoint Online
Getting Started with PowerShell and SPO Base OS
Windows Server 2012, Windows Server 2008 R2 SP1, Windows 8, Windows 7 SP1
.NET Framework 4.5
Windows Management Framework 3.0
Microsoft Online Services Sign-in Assistant
All the latest updates
Windows Azure AD Module for Windows
PowerShell 32-bitSharePoint Online Management Shell
Windows Azure AD Module for Windows
PowerShell 64-bit
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]
What commands are available?Get-Command –Module Microsoft.Online.SharePoint.PowerShell
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*}
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
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
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
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
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“
PowerShell with Office 365 and SharePoint Online
ThanksStick around for Q & A
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
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
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
Q & A
1-888-5-NETCOM (563-8266)[email protected]