SharePoint Presentation regarding usage of PowerShell and API techniques to work with data, configuration objects and troubleshooting methods in SharePoint.
1. Getting Everything You Ever Wanted Out of
SharePoint (via PowerShell)
SharePoint User Group - Cambridge, UK
Presenter: Corey Burke
December 2, 2013
1
2. Who does this guy think he is?
• Corey Burke
• Architect, trainer, speaker and founding member of the SharePoint Hosting Services team
at Rackspace: The Open Cloud Company
• Contributing author - Professional SharePoint 2013 Administration
• Technical Editor - Beginning SharePoint 2013: Building Business Solutions
• Recovering anti-socialite
• Email
• Corey.Burke@rackspace.co.uk
• Blog
• http://blog.sharepoint-voodoo.net
• Twitter
• http://twitter.com/cburke007
• Find me on LinkedIn
• http://uk.linkedin.com/in/cburke007/
RACKSPACE® HOSTING
|
WWW.RACKSPACE.COM
3. About Rackspace
• The largest collective
team of SharePoint
MVPs.
• Over 1,000,000
dedicated seats.
• The largest collection
of published
SharePoint authors.
• The most 'Microsoft
Hosting Partner of the
Year' awards (4)
• The most published
SharePoint books.
(23 and counting)
• The only company with
Fanatical Support®
(As stated by Microsoft at the 'Worldwide Hosting Summit', May 23rd, 2013.)
RACKSPACE® HOSTING
|
WWW.RACKSPACE.COM
3
4. The Good Stuff…
What we’ll be covering today
– Evolution of SharePoint Administration
– API: Who needs it?
– What do YOU want?
– Where to begin?
– Getting your hands dirty
– Using what you got
RACKSPACE® HOSTING
|
WWW.RACKSPACE.COM
4
5. Evolution of SharePoint Administration
Pre-SharePoint
Era
SharePoint Era
2001/2003
2007
STSADM
.NET API
2010/2013
CMDLets
RACKSPACE® HOSTING
|
WWW.RACKSPACE.COM
5
9. The Who, What, Why’s of the API’s
• What is it?
– Application Programming Interface
• Who needs it?
– Developers
– SysAdmins
– DevOps
• Why should I care?
– Direct .NET access from compatible languages
• Which includes PowerShell
– Ultimate Flexibility
RACKSPACE® HOSTING
|
WWW.RACKSPACE.COM
9
10. Ewww! I’m not touching that!
“I’m an Infrastructure person. I never touch the APIs…”
RACKSPACE® HOSTING
|
WWW.RACKSPACE.COM
10
11. What Do YOU Want?
Farm Build
Version
List ID
Documents
Data Output (File System,
Text, CSV, XML, etc…)
RACKSPACE® HOSTING
|
WWW.RACKSPACE.COM
11
12. Choosing an Entry Point
Farm
Servers
Web Applications
Databases
• SPFarm
• Farm Configuration
• SPServer
• Server Properties, Server Roles (Web Front End, App, Database)
• SPWebApplication
• Web Application Properties, Content
• SPContentDatabase
• Content Databases & Properties
Site Collections
• SPSite
Webs
• SPWeb
Lists
Items
• Site Collection Properties, RootWeb, Collection of Webs
• Web Properties, Team Sites, Publishing Portals, etc.
• Document Libraries, Discussions, Surveys, etc.
• Documents, Images, Contacts, Pages, etc.
RACKSPACE® HOSTING
|
WWW.RACKSPACE.COM
12
13. Getting Your Hands Dirty
• Data Hunting Tools
– Get-Help
– Get-Member
• Examples:
– Properties vs. Methods
RACKSPACE® HOSTING
|
WWW.RACKSPACE.COM
13
14. What do I do with my data?
RACKSPACE® HOSTING
|
WWW.RACKSPACE.COM
14
16. Migrating Content
•Scenario
–You are an Administrator tasked with rapidly migrating
50+ content databases:
• Development Farm to Test Farm
• 2007 to 2010
• 2010 to 2013
RACKSPACE® HOSTING
|
WWW.RACKSPACE.COM
16
18. Gathering Data
• What information do we need to replicate the
configuration?
– Web Application URL
– Content Database name
– Status (Started or Stopped)
– A means of storing the configuration information (CSV, Text, XML,
etc.)
RACKSPACE® HOSTING
|
WWW.RACKSPACE.COM
18
23. WSS Profile Pictures Won’t Sync
• Scenario
– Content was migrated to a new Farm
– A new URL is has been used in the new Farm
– The Sync job from the Profile Sync Service is only syncing some
pictures while others remain broken links pointing to the old URL
• You already tried stsadm –o listolddatabases and deleteolddatabases
commands with no change
RACKSPACE® HOSTING
|
WWW.RACKSPACE.COM
23
24. Where to begin?
• We need to fix all user profiles in the Site
Collection
– Where are the WSS profiles in the Site Collection?
• “_layouts/15/people.aspx?MembershipGroupId=0”
• How do I find the Picture Field for each user?
RACKSPACE® HOSTING
|
WWW.RACKSPACE.COM
24
27. Results
• Don’t forget to run
– Stsadm –o sync –deleteolddatabases 0
• Make sure your logged on user has Full Control Permissions to the User Profile Service App
– Then wait an hour, or manually run the “User Profile Service Application - User Profile to
SharePoint Full Synchronization” Timer Job from Central Admin
RACKSPACE® HOSTING
|
WWW.RACKSPACE.COM
27
28. Backup Content to File System
RACKSPACE® HOSTING
|
WWW.RACKSPACE.COM
28
29. Backup Content to File System
•If it is in SharePoint it can be taken out of
SharePoint
•Scenario
–“I need a backup of just the documents in a Site
Collection so I can start over.”
RACKSPACE® HOSTING
|
WWW.RACKSPACE.COM
29
Setup:Plug in ClickerConnect to SP and SQL VMsOn SP VM:Load up PowerShell ISELoad Scripts from ”C:\Users\BizSP_SP_Admin\Downloads\GettingEverythingSP”Load up CA and http://portal.contoso.comLoad up login text fileMake sure ”C:\Users\BizSP_SP_Admin\Downloads\GettingEverythingSP\Backups” is emptyOn SQL VM:Load up SQL MGMT StudioIcebreakers:I’ve been in London since January, but this is my first time in Cambridge. Beautiful city, I will have to bring my family back here for holiday.
Rackspace has been around for about 15 years now. I joined the company about 7 years ago. In the last 5 years that we have been selling and supporting SharePoint hosting, we have grown to over 1,000,000 dedicated seats. MS announced at the Worldwide Hosting Summit that we now carry 85% of the global dedicated hosting license. That’s huge given our relative newness compared to some of our SharePoint hosting competitors.Last year we expanded our Consulting Services capabilities with the acquisition of SharePoint 911. Anyone familiar with Shane Young, Todd Klindt, Laura Rogers, Jennifer Mason, Randy Drisgill, John Ross, all of these folks now work for Rackspace, giving us the largest collection of SharePoint MVPs under one roof, helping us to grow and improve our support capabilities.So that’s Rackspace, enough of the boring self glorification and onto…
Anyone here not familiar with PowerShell? Don’t worry I won’t hold it against you… I try to keep my example code as simple as possible, but when we get to the demos feel free to ask questions if anything doesn’t make sense.
Pre-SharePoint era – Marked by heavy use of file shares, printing and filing of emails, swinging from trees, you get the idea… This was not man’s greatest period of collaboratiom. No fire was discovered here…STSADM – The first tool created for Admins to manage SharePoint configuration. Crude, but occasionally effective, not flexible in the slightest. PowerShell was also being developed during this time….NET API – With the advent of SharePoint 2007 came a robust .NET API. With the success of PowerShell and native .NET API access the world began to open up.CMDLETs – With the release of SharePoint 2010, PowerShell reached maturity within the product with native PowerShell CMDLets that do most of the API access work, greatly simplifying data access and manipulation.
Results: We can only go as far as listing the solutions in the Farm in a plain text output.
Here you can see that accessing through cmdlets does not differ greatly from the .NET example.Two main differences from .NET1) How PowerShell gains access into the SP API2) How you create an objectCMDLets handle getting the objects for youCMDLets are still limiting in that there are not CMDLets for every type of object you may need to interact withDownside Example: No CMDLets exist for setting People Picker settings
What:Objects are created from a blueprint, called a class, that defines the base properties that every object created from it will contain. This clicker has properties, such as color, weight, laser intensity. The clicker also has methods for taking input, such as the on/off switch, left/right mouse click, etc.Somewhere, someone has a blueprint that defines how this clicker is to be built so that the methods always work exactly the same, but the properties, such as color, can be changed.The API defines and provides the methods by which one interacts with the objects derived from the class definitions. Such as Clicker1.LeftClick() method performs an action. Clicker1.Color = “Blue” changes a property.Why:Coder’s – To be able to write new applications or new functionality for an existing application frameworkSysAdmins – Troubleshooting, AutomationExamples: Migrating user profiles from one domain to another, Finding solutions to problems that used to require lengthy, and expensive, engagements with Microsoft
This is my reaction whenever an Admin says this out loud. A good rule of thumb, even of you HATE programming of any kind, is to never say this out loud.It shows a fundamental lack of understanding of what an API is, and the benefits that scripted automation can bring to a business and the Admin role.Often the Admins are the ONLY ones in a business capable of improving Administration processes and tools through scripting.If you manage any kind of software infrastructure, you NEED scripting languages and knowledge of how APIs work.
What is it you need out of SharePoint?Documents?ListID? Farm Build Version? Your solution packages because you lost the originals? List of activated Features?If it is stored in the configuration database, content, service applications, etc, it will be available through PowerShell, even if it is not available through Central Administration or the SharePoint Site.This is the easy part, unless you are troubleshooting in which case this may in fact be the hardest part. For our current position in this presentation we will assume this is the easy part.
My most often used format is to store data in CSV file format. CSV stands for Comma Separated Values, and is just a plain text file that contains rows of related data, much like a table in a SQL database, or worksheet in Excel, separated by commas into “columns”.
Or any combination of the above, or maybe you are building a same version Farm to migrate to because something irreparable is wrong with your live Farm.Working with 50 or more content databases can be a daunting task, especially if they are spread across multiple web applicationsYou could go buy some tool to do this, but when you are faced with getting something like this accomplished quickly you have to be able to think on your feet or you could have some sleepless nights ahead. Using PowerShell can save your company some money, impress your peers and get you home in time for dinnerWith a minimal amount of effort you can have this done in no time.