Obligatory SharePoint 2013 Search Powershell post

Maybe you’re still kicking the tires on SharePoint 2013 installing it for the first time. Maybe you’re in the throws of planning your migration. Maybe you’re a consultant who’s been stuck on a SharePoint 2010 project for the last 18 months. Either way, we all have to face the music sooner or later and upgrade to SharePoint 2013. When you do, you’ll have to setup a Search Service. It’s not as bad as you’d think. And if you have at least 3 servers in your farm (1 app and 2 WFEs) then this script will work for you. Without further delay:

#Config Section
$APP1 = "App1"
$WFE1 = "WFE1"
$WFE2 = "WFE1"
$SearchAppPoolName = "SearchServiceAppPool"
$SearchAppPoolAccountName = "domainSearchSvc"
$SearchServiceName = "SharePoint Search Service"
$SearchServiceProxyName = "SharePoint Search Service Proxy"
$DatabaseServer = "DBserver"
$DatabaseName = "SP_Search_AdminDB" 

#Create a Search Service Application Pool
$spAppPool = New-SPServiceApplicationPool -Name $SearchAppPoolName -Account $SearchAppPoolAccountName -Verbose 

#Start Search Service Instance on all Application Server
Start-SPEnterpriseSearchServiceInstance $App1 -ErrorAction SilentlyContinue
Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance $App1 -ErrorAction SilentlyContinue

#Start Search Service Instance on WFEs
Start-SPEnterpriseSearchServiceInstance $WFE1 -ErrorAction SilentlyContinue
Start-SPEnterpriseSearchServiceInstance $WFE2 -ErrorAction SilentlyContinue

#Create Search Service Application
$ServiceApplication = New-SPEnterpriseSearchServiceApplication -Partitioned -Name $SearchServiceName -ApplicationPool $spAppPool.Name -DatabaseServer $DatabaseServer -DatabaseName $DatabaseName 

#Create Search Service Proxy
New-SPEnterpriseSearchServiceApplicationProxy -Partitioned -Name $SearchServiceProxyName -SearchApplication $ServiceApplication
$clone = $ServiceApplication.ActiveTopology.Clone()

#Set variables for component creation
$App1SSI = Get-SPEnterpriseSearchServiceInstance -Identity $App1
$WFE1SSI = Get-SPEnterpriseSearchServiceInstance -Identity $WFE1
$WFE2SSI = Get-SPEnterpriseSearchServiceInstance -Identity $WFE2

#Create Admin component
New-SPEnterpriseSearchAdminComponent –SearchTopology $clone -SearchServiceInstance $App1SSI 

#Create Processing component
New-SPEnterpriseSearchContentProcessingComponent –SearchTopology $clone -SearchServiceInstance $App1SSI

#Create Analytics Processing component
New-SPEnterpriseSearchAnalyticsProcessingComponent –SearchTopology $clone -SearchServiceInstance $App1SSI

#Create Crawl component
New-SPEnterpriseSearchCrawlComponent –SearchTopology $clone -SearchServiceInstance $App1SSI

#Create query processing component
New-SPEnterpriseSearchQueryProcessingComponent –SearchTopology $clone -SearchServiceInstance $App1SSI

#Set the primary and replica index location; ensure these drives and folders exist on application servers
$PrimaryIndexLocation = "C:SPSearch"
$ReplicaIndexLocation = "C:SPSearchReplica" 

#We need two index partitions and replicas for each partition. Follow the sequence.
New-SPEnterpriseSearchIndexComponent –SearchTopology $clone -SearchServiceInstance $WFE1SSI -RootDirectory $PrimaryIndexLocation -IndexPartition 0
New-SPEnterpriseSearchIndexComponent –SearchTopology $clone -SearchServiceInstance $WFE2SSI -RootDirectory $ReplicaIndexLocation -IndexPartition 0
New-SPEnterpriseSearchIndexComponent –SearchTopology $clone -SearchServiceInstance $WFE1SSI -RootDirectory $PrimaryIndexLocation -IndexPartition 1
New-SPEnterpriseSearchIndexComponent –SearchTopology $clone -SearchServiceInstance $WFE2SSI -RootDirectory $ReplicaIndexLocation -IndexPartition 1

$clone.Activate()

#Verify Search Topology
$ssa = Get-SPEnterpriseSearchServiceApplication
Get-SPEnterpriseSearchTopology -Active -SearchApplication $ssa

This script is actually pretty basic. 90% of the services end up on your App box, while the Index partitions live on your WFEs. You could provision the service on one box or any combination you see fit. That’s the beauty of this model. For me, I like having the Index partition closest to where people will be searching (i.e. the WFEs).

The script should take anywhere from 10-30 minutes to run, maybe longer depending on your hardware. Once done, navigate to your Search Service in Central Admin and this is what you should see in the Search Topology.

Most important thing to remember when using this script is to create the C:SPSearch and C:SPSearchReplica directories on your WFEs PRIOR to running this script. The script will fail if you don’t do this and it’s a pain to cleanup after so create the directories first. I’ll probably write in a check to see if the directories exist – and if they don’t go, ahead and create them – next time I run this script when setting up an environment.

Pre-req installer may not progress past IIS configration.

I’m pissed. Like, in disbelief pissed. Kinda like my buddy Tracy:

Anyone seen this KB? The Products Preparation Tool in SharePoint Server 2013 may not progress past “Configuring Application Server Role, Web Server (IIS) Role”

The KB lists 2 possible workarounds: 1) Install a hotfix; or , 2) Run a whole bunch of PowerShell that requires the OS .iso readily available. I’ve tried both with little to no success. I especially see issues when it comes to the AppFabric and Distributed Cache.

So you can imagine my disbelief when the true workaround is to Install the IIS role first before running the Pre-Req installer. Do that and the pre-req installer runs just fine (at least on Server 2012). Son of a…

SharePoint on Azure: several lessons learned

We got back from Convergence on Friday. I had a good time overall; good food, good times, crazy things to see. Never did make it to Acme Oyster House (sorry dad!).

Meanwhile, we’ve migrated a public SharePoint site to Azure. I should say we’ve migrated a SharePoint 2010 internet site to SharePoint 2013 running in the 14-hive. Many of my colleagues throughout the SharePoint community I’ve spoke to have this to say about that:

In the last few weeks we’ve learned some valuable lessons. Here they are (in no particular order):

  • Search scopes – I chose to not migrate the Search databases because migrating the content db was hard enough. Plus, when we complete the upgrade to 2013 I would just have 1 DB to focus on. In doing so, I don’t have scopes anymore since they’ve been deprecated in SharePoint 2013. You can’t even use PowerShell to add them. The fix was to revert back to the All Sites scope. It isn’t the end of the world though because the Search Service App is smart enough to see the variation you’re searching from and serve up that site’s content. For example, if you search for bikes on the German site, you’ll get German site content back to you, rather than UK or US content.
  • SharePoint Designer – Someone wanted a quick change to a page layout. Good news here is that only 1 page in the overall site uses that page layout. SharePoint Designer 2010 works but I was unable to add another web part zone the page layout. As a workaround I added the HTML directly to the page layout. Again, not the end of the world here, but it definitely isn’t what I would want to do. Adding a web part zone would have allowed me to drop additional content in the future or replace it altogether from the Edit Page rather than editing the Page layout.
  • compat.Browser config – We never bothered with mobile sites in SharePoint 2010 with this site. All we did was turn off the mobile browsers in the compat.browser config. I did the same for SharePoint 2013 (set all ismobiledevice to false) then reset IIS. However, this did not result in success. Got hit with a vague SharePoint error. I started looking on the interwebs for help and ran across this: LINK. Followed Option 2 and hit pay dirt. It does seem out there to have to drop a statement in to the overall web.config but I had to get things working. Once we migrate to SharePoint 2013 we’ll remove the statement and make use of device channels but since we’re still running in the 14-hive I don’t get that functionality quite yet.
  • Azure IaaS growing pains – IaaS is still in preview, and thus you’re subject to wonkiness and issues beyond your control. A few days ago we experienced an outage on the site. SharePoint couldn’t talk to SQL for some reason. Logged on the SQL box and couldn’t even connect to the SQL instance. The service was running but still no dice. Well, time for a restart and Yahtzee! everything was better. I went through the logs as best I could but had no idea what I was looking for. Come to find out Azure pushed down restarts. In doing so, SQL came back before the AD instance did so nothing was authenticating properly. HUGE lesson learned there. Best way to overcome this is to start using Availability Sets: link to documentation.
  • Calculated Column issues – had a user come to me with this one. The user noticed that a calculated column was throwing a string of characters into the column. I went and checked the column settings and miraculously the issue was gone. I edited another item and got the exact same string again. So it would appear that it wasn’t the formula but rather something was going on in the DB. Luckily I was at Convergence and there were a handful of SharePoint support folks in the Expo hall. Ran by their booth and showed them the issue. Thankfully this is a known issue and installing the March PU will fix everything: link to PU. One other note, according to the KB, you MUST install this PU if you ever hope to install a future CU.

That’s about it for now.

#SPSSTL recap and other things

#SPSSTL (SharePoint Saturday St. Louis) was this past weekend. Very much a success. The more I go to these free events I realize just how important they are to the IT community. Both SharePoint and SQL offer these and they are absolutely worth their weight in gold. I hear the Windows Server folks are trying to start them too.

The benefits? Where do I start? First of all, they’re free. Doesn’t cost you more than your time and attention. Secondly, they feed you breakfast AND lunch. I guess there really is a free lunch in this life after all. Thirdly, you get to meet not only local talent, but you also get free access to many Microsoft MVP’s and taste-makers. Often times we look at some of these folks as absolute rock stars and we get to talk to them . . . for free! When was the last time you got to talk to Justin Bieber . . . for free?  Wait, what?

My session was entitled: Case Study: How SharePoint and Yammer shine together at Trek Bikes. I recapped all the things we’re doing at Trek to make SharePoint and Yammer work for folks. Really got down to some specific use cases and described the steps involved to go from point A to point B with each department. You can find my slides HERE. Overall, I had great attendance and the audience seemed to get in to what I was talking about. Got some awesome feedback and kudos so thank you all for that.

Several folks brought up an interesting point throughout Saturday. They don’t use Yammer at their workplace because it creates another place to save documents. Folks, odds are better than good that your workplace employs e-mail, public folders, shared drives, SharePoint, and individual workstations. That means people already have a number of places to save content. Adding Yammer will not add an exponential amount of complexity for information workers when it comes to saving things. Odds are they’re already complaining about the amount of places to save things. You can easily replace public folders with Yammer, and you may even be lucky enough to replace shared drives with SharePoint (I’m not that lucky…yet). Choosing not to deploy Yammer because it creates too many places to save documents is near-sighted and ignorant. Definitely a “throwing the baby out with the bath water” scenario. You’re dismissing all the social benefits that the tool provides just so you can make document management easier. IMHO, social takes precedence over document management. And since Yammer integrates so well with SharePoint’s search I highly recommend you rethink your approach on Yammer if you’ve avoided it up until now.

Some of the other sessions I attended were JWillie’s Rich vs. Reach presentation. Very interesting approach and very interesting topic. Felt much more conversation-ary and collegial. Would like to try that approach in the future. Jeff talked about how mobile is becoming more and more common and he shared some of the things Rightpoint is doing. Always cool to see how other companies are approaching this impending tidal wave.

Caught Bill Feldker and Benjamin Niaulin’s presentations on SharePoint 2013’s Search capabilities. You’ll need to completely change your way of thinking about SharePoint Search in 2013. An entirely new subset of SharePoint careers will be developed around Search in 2013. Just way too many good things to mention when it comes to Search. Both gentlemen did an outstanding job on their presentations. I seriously thought Tamara Bredemus’ head was going to explode during Benjamin’s talk. 

And finally, I caught Andy Milsark’s 2013 upgrade talk. Pretty amazing how far we’ve come in such a short time. The upgrade path from WSS 3.0 to MOSS was long, daunting, and scary, and that was just 5 years ago when people started doing that upgrade en masse. The SP2010 to SP2013 upgrade can be covered in an hour and realistically be accomplished in one day on small farms. Unbelievable.

I know I promised you the “greatest test environment since sliced bread,” but I’ve been busy with other things. I’ll try to get the first installment written this weekend.

The mother of all Test environments (series)

So a few weeks ago I set out to create the mother of all Test environments at work running the latest Microsoft tech. We’re talking SharePoint 2013, Lync 2013, and Exchange 2013 all running on Windows Server 2012. In addition, my SQL backend is SQL 2012 SP1, and my workstations are running Windows 8 with Office 2013. All brand new tech that I won’t be able to put into production for months (if not 201 4).

It’s all set up now and let me tell you…it is a thing of beauty.

I’m going to putting together a series of articles outlining all the lessons learned and the pitfalls I ran into. The series WILL NOT be regurgitating MSDN and Technet articles; 1) because Microsoft pays their writers handsomely to write that stuff; and, 2) I’m a lazy blog writer.

My first post will be around setting up my VMs and the Domain (complete with AD Certificate Services). Who’s excited!? I know this kid is: