View my install SharePoint 2013 Webinar

My Christmas gift to you!

I don’t know why I didn’t do this years ago. I guess you can thank the fine folks at Rackspace for this. Today I did a 1.5 hour webinar on installing and configuring SharePoint 2013. And in a totally unexpected twist not only did everything work but I actually got everything done in the allotted time. You know what is even more exciting? I recorded the whole thing and the recording is available for you to watch. The link to the webinar is at this webinar link. Sorry you will have to register to watch just because that is how the tool works.

There is also a presentation I used during the webinar with some screenshots, PowerShell, and other links. You can find that presentation at this link.

The team is actually doing a bunch of these this week. You can sign up or watch the recordings by using the links found here.

Hope you enjoy the show. Happy holidays!

Shane

SharePoint 2013 is coming, SharePoint 2013 is coming

Thankfully, unlike the night of Paul Revere’s fateful ride we are happy to see it coming. Side note: If you are bored go read this article talking about Israel Bissell who did the hard work. He managed to ride 345 miles to Paul’s 12. Unfortunately Bissell doesn’t rhyme as well as Revere. J Ok, enough history back to SharePoint.

SharePoint 2013 is exciting with lots of new features. Two of the biggest will be more social capabilities and the App store. The inspiration for social feature are pretty clear, it is like a hybrid of Twitter and Facebook. That’s a really good thing as we move closer to the social enterprise. The App store just makes sense. Everyone these days has more Apps than they can even imagine at their fingertips on their smart phones, it was only logical that other software would start having the same capabilities. These two features are just scratching the surface of SharePoint 2013. Fortunately, if you are interested, Microsoft has some great reading on what is new and the Rackspace team has provided 9 free videos showing off some of the 2013 coolness. This article isn’t about what is new.

The thing I want to focus on, the information that is hardest to find, is what you can be doing today to get ready for when the final version of SharePoint 2013 is released. The easy answer is nothing. If you are actively caring for and feeding SharePoint then you have nothing to worry about. On the other hand, if you haven’t been showing your SharePoint farm all the love and attention it deserves don’t feel too bad, about 95% of farms are in the same situation. If you are a little behind, let’s talk a little about your “fall cleaning” plans.

Patching

Where are you with patching your current SharePoint 2010 farm? You don’t know do you? That isn’t a good sign. Luckily Todd has a great post that helps you find your build number and then tells you what that number means. Now, when you look at Todd’s list you don’t necessarily need to be on the latest and greatest; technically as long as you are at RTM then upgrading to 2013 is supported. Let’s be honest though, you shouldn’t be running RTM. You should be at service pack 1(SP1) at a minimum. There are 100′s of fixes between RTM and SP1 so if you are not there then get a plan together to get there. What about all of those cumulative updates (CU) after SP1? Good question. As a rule of thumb you shouldn’t apply a CU unless you have a specific problem and you can point to the CU that fixes it. CUs are not tested like service packs and can introduce a lot of risk. With that in mind be sure to read Todd’s note on each Cumulative Update carefully to get an idea of what features they may fix or add. Another important point to remember, there is no way to uninstall a SharePoint CU or SP once you start installing it, so practice on a test farm first and then plan for the worst.

Purging

When was the last time you deleted old content out of SharePoint? No, not your field guide to the battle of Lexington and Concord, but all of those SharePoint sites that nobody uses. There have been studies that show up to 50% of collaboration sites that get created are never used. Even if you are 50% better than the average company, did you delete the 25% that aren’t in use? Probably not. This is a great way to get ready for your upgrade. Everything about less content is a win when it comes to doing an upgrade. Nothing is worse than troubleshooting upgrade errors for content that you just end up deleting.

Preparing

Since SharePoint 2013 isn’t RTM yet hardware specifics are still a little up in the air, but it is still obvious there will be changes. For example, are you using the Office Web Applications in SharePoint 2010? In 2010 Office Web Apps are required to be installed on a SharePoint server. In 2013 it is required that they not be installed on a SharePoint server. With that one change you have already added at least one server to your farm. What about the operating system and SQL? Windows Server 2008 (not R2) and SQL 2005 or 2008 were supported. Not with SharePoint 2013. Digging into the hardware and software requirements document provided by Microsoft will give you the information you will need to start planning you infrastructure to support SharePoint.

There is a lot more you could do to get prepared, but let’s not get carried away. Your server room has smoke detectors, so one lantern by land or two by water might be overkill. If you can get through patching, purging, and preparing then you should be in good shape.

Shane Young – Rackspace Hosting

A simple install of SQL Server 2012 for SharePoint Server 2013 or 2010

One of the things that comes up in my SharePoint Administrator classes a lot is people who are looking for an easy guide to just get SQL Server up and running so they can deploy SharePoint. They aren’t looking for best practices or optimal configurations just cut-to-the-chase, what they should do, instructions. So in this blog post I have attempted to provide that. If you are an old pro at SQL installs (meaning you have done it more than twice) this post isn’t for you. If you are new to it all then read on.


These instructions were written using Windows 2008 R2 but I did use them on a Windows 2012 VM and the steps were the same except I did not have to install the .NET piece.


There are three things you need to get a SQL Server ready. Install, configure max degrees of parallelism, and setup your SQL permissions.


Installing SQL Server 2012 for SharePoint


  1. Run setup.exe
  2. From the SQL Server Installation Center click on Installation on the left hand side of the page.
  3. On the right hand side of the page click on New SQL Server stand-alone or add features to an existing installation.

  4. After the Setup Support Rules run, click OK.
  5. Enter your appropriate Product Key and then click Next.
  6. Select I accept the license terms.
  7. Select Send feature usage data to Microsoft….
  8. Click Next.
  9. When the Setup Support Rules screen pops up review any errors or warnings you get. If nothing bad has happened the Next button will be available to click. Click Next.
  10. For Setup Role select SQL Server Feature Installation and click Next.
  11. On the Feature Selection screen this is where you need to be smart. In order to make SharePoint run you only need to select one check box, Database Engine Services. I would highly recommend you also check Management Tools – Basic and Management Tools – Complete.

    Now when you read all of these awesome features you might be thinking “I want to kick the tires of Reporting Services – SharePoint” or some other random feature. That is great, tire kicking is fun and important but if you are reading the blog post to get SQL Server installed correctly for SharePoint then you probably aren’t ready to start randomly installing features. Even if you were ready to install them you would still most likely come back and do them after SharePoint was up and running, not before. So let’s ignore them for now and click Next.

  12. On the Installation Rules screen SQL will make some checks. In this case my Server did not have the Microsoft .NET Features installed. You will need to manually add the feature now. While you do go ahead and leave this SQL window open.

  13. To add the .NET Windows Server feature click on Start > All Programs > Administrative Tools > Server Manager.
    1. From the right side of the screen click on Features.
    2. Over on the left side of the screen click on Add Features.
    3. Check the box for .NET Framework 3.5.1 Features.
    4. When you check the box a window for Add Features Wizard will appear telling you the additional required roles. Click Add Required Role Services.
    5. Click Next.
    6. At the Web Server (IIS) screen click Next.
    7. Accept all of the defaults and click Next.
    8. At the Confirm Installation Selections click Install.
    9. At the Installation Results screen make sure everything was successful and then click Close.
    10. Jump back over to your SQL Installation Rules screen and click the Re-run button.
  14. If the tests are Passed click Next to continue.
  15. Assuming this is the only install of SQL Server on this server then you are going to want to take all of the default settings for the Instance Configuration screen. If you have other SQL Instances installed on this server you are more advanced than reading this blog post. J Click Next.
  16. At the Disk Space Requirements screen click Next.
  17. For the Server Configuration screen it is asking you what accounts you want to run SQL Server as. The only service you are worried about right now is the SQL Server Database Engine. This service should always be run as a domain account not a local account. Next to SQL Server Database engine click on NT Service\MSSQLSERVER and a drop down arrow will appear.

  18. Click <<Browse…>>.
  19. Select your SQL Service account and click OK.
  20. Enter the account password and click Next.

  21. On the Database Engine Configuration screen there are lots of changes you could make and over time you will learn about these options but for the purpose this guide you will except all of the defaults. You only need to click Add Current User before you continue on.

     

    If you were building a production capable SQL Server best practice 101 would be to store your data and log files on different volumes. By default SQL Server will store everything on the C: drive. If you want change that behavior take a gander at the Data Directories tab.

  22. Once you are ready click Next.
  23. For the Error Reporting screen select Send Windows and SQL Server Error Reports…
  24. Click Next.
  25. At the Installation Configuration Rules screen click Next.
  26. You are Ready To Install, so click Install.
  27. When the installation finishes you may be prompted to restart. This is not directly because of SQL Server but instead because of other recent installs you have done that you haven’t rebooted since. In my case because I added the .NET feature. When SQL is all done click Close. If you have any other open windows at this point you can close them as well. You are all done.
  28. If you got the pop up screen to do a reboot it will not automatically happen, you will need to Reboot on your own.

Max Degree of Parallelism


Now that you have SQL Server all installed there is one more configuration change you need to do in order to make SharePoint happy. You need to change the max degree of parallelism. Don’t ask me what that is. Something about number of processors and how SQL uses them. Unfortunately SQL Server defaults to 0 and SharePoint 2013 necessitates, demands, forces, requires, and otherwise really wants you to set it to 1. So make the change. If you are running SharePoint 2010 this change is not required but is recommended.


Now if you look at the link I gave you saw a bunch of fancy SQL to change it. Barf! Let’s change it the easy way, with a mouse.


  1. From your newly installed SQL Server click Start > All Programs > Microsoft SQL Server 2012 > SQL Server Management 2012.
  2. On the Connect to Server screen click Connect. If for some reason the Server name: field is blank you would just type in the name of the server.
  3. At the top of the Object Explorer window you see your server. Right click on it.
  4. From the menu that appears click Properties.
  5. In the Select a page section click Advanced.
  6. Scroll to the bottom and change Max Degree of Parallelism from 0 to 1.
  7. Click OK.

That does it. No need to reboot or anything else to make the change take effect.


SQL Permissions


One more quick change since we already have SQL Server Management Studio running. You need to give the Windows Account that you plan to install and configure SharePoint with some elevated rights in SQL. Typically we recommend you use a dedicated account (I like the name sp_install) and this account will need the following roles on the SQL Server.


  • DB_Creator
  • Security_Admin
  • Public

     


  1. Make sure you still have SQL Server 2012 Management Studio open on your SQL Server.
  2. From Object Explorer expand out Security.
  3. Under Security expand out Logins.
  4. Right click on Logins.
  5. From the menu choose New Login….

  6. For Login name: enter domain\sp_install or whatever account you will be logged into SharePoint as when you do the install.
  7. On the left, under select a page click Server Roles.
  8. Check the box for dbcreator and securityadmin. Also, leave public selected.

  9. Click OK.

Hooray! Now you have your whole SQL Server ready to rock and roll so you can install SharePoint.

Why haven’t you patched your SharePoint farm?

AHHH! It seems a week doesn’t go by that I don’t find some ancient SharePoint farm lying around. Just recently I found such an environment that one of our customers was using. I swear this last one was used by the ancient Egyptians and was using the Hieroglyphs language pack. As of May 29, 2012 that farm is running SharePoint Server 2007 RTM. RTM? Yes, you know the thing that came out on November 11, 2006. That was 2,026 days ago! Can you imagine not patching your server for over 2,000 days? That is just crazy! Oh, and in case you were wondering, this was one of their production farms. (And don’t get me started on the insanity of having multiple production farms without really good reasons, which they didn’t have.)

Why do I care so much? Because I am a caring kind of guy. Ok, maybe not. Really, it’s more because they are doing two things that make me a sad panda. One is giving SharePoint a bad name. I don’t know the exact number but let’s just say there have been hundreds of fixes, several performance enhancements, and more than handful of new pieces of functionality introduced in those 2,000-plus days since SharePoint 2007 was first released. And those patches, performance enhancements, and new functionality generally help alleviate many of the pain points some users may be having with SharePoint. If the users of that farm were complaining about something not working right, chances are that issue could have been addressed by simply applying updates to the farm. And, they could get all of that for exactly the price of free. Ok, I realize “free” isn’t completely true because patching does have an associated cost but, whatever that cost is for you it is far outweighed by the cost of not patching. I will not dive into the nerdy details on this topic but remember you should always test your patches on your TEST FARM before you install them on your production farm. J

The second downside of not keeping up with your patches, and what aggravated me the most about this customer, is there is often a minimum build that a farm needs to be at in order to upgrade to the next version of SharePoint. This customer is on SharePoint 2007 RTM and they want me to move them to SharePoint 2010 (hopefully not RTM). The only problem? SharePoint 2007 has to be at Service Pack 2 or later before you can even attempt to do an upgrade! Then I ask the customer what it will take to do an upgrade and they send me over a nine slide PowerPoint that I will need to work through to help me submit the upgrade proposal to their IT governance group. It will take me probably four hours of my life just to go through the first round of justification to put this patch on, and this is even before getting to the actual upgrade to SharePoint 2010. WHY? You can give me your song and dance about controls and such but this is just ludicrous. I have written a lot of governance plans for SharePoint and I have never included a section on requiring a sacrifice to deploy a two year old patch that is pretty much mandatory. Heck, I’ll even point out that right now they are not even supported. Support for the RTM version of SharePoint 2007 stopped January 13, 2009 if I can read the Product Lifecycle correctly.

If you are still on SharePoint 2007 and want to check where you are with patches you can use this link. For SharePoint 2010 use this one.

So in the future, please do yourselves, your users, and even me a favor by keeping your SharePoint farm up to date with the latest patches. You’ll be happy you did, and I will too!

Shane

Health Check – Happy New Year to you and your SharePoint servers!

Happy New Year. Hopefully you have recovered from all of the good times and/or you got some rest on the break.

I figured many of us have SharePoint 2010 deployments at this point that are mature. Which is awesome. But one thing I know about mature SharePoint farms is we often take them for granted. Below I am going to throw a couple of things at you to double check this week and make sure SharePoint is happy.

What is your build number?

You should be running at least service pack 1 at this point. Now if you are not I am not recommending blindly installing it on your production server. You should test it first. J But once you do let’s get it on there. How do you check your build number? Todd has a great blog post here that will show you how to find your build number and then tell you what it means. He also has links to the different patches for download. Remember service packs are always good cumulative updates… you should only install them if you have a very specific reason and you have tested.

Check those health rules

We have all gotten used to the big read bar at the top of the page in Central Administration. We know that it is generally there because some of the rules can just never be made happy. But when was the last time you checked to see what problems it was reporting? Especially with some of the updates the rules have gotten better. So take a quick peek at the list today and see if there is anything you can remedy. No reason to have a broken farm.

Check your disk space

What the heck. I know when I was a full time systems guy I had scripts that checked drive space daily and reported back to me. But maybe you don’t. Either way RDP into all of those servers and just make sure some rogue log or temp files aren’t wasting a bunch of space. It will take you 5 minutes per server and might very well save you from having a bad day in the future.

How is SQL Server doing?

Whether you manage your SQL Server or you have a DBA who does it you need to ask the questions. This isn’t a perfect list but off the top of my head I would ask:

  • How much free space do we have on the data drive? The log drive? The backup drives?
  • How long is that space going to last us at current growth rates?
  • When was the last time someone confirmed we can restore from the SQL backups?
  • Does SQL need any patches applied for general SQL Server health?
  • Anybody checked the SQL logs for errors?

Remember even though it is easy to say that isn’t your job it is. If SQL Server isn’t happy then SharePoint isn’t happy.

What is your backup/restore plan?

I know you have one in theory but do you have one in actuality? When was the last time you did a practice restore? I will leave at this. You know if you have a bad feeling in your stomach right now or not.

Clearly this isn’t an exhaustive list but you get the idea. Spend this slow week making sure that awesome server farm you built is still awesome. Next week you will start getting busy and will go back into firefighting mode. Don’t make your next SharePoint touch point require a 4 alarm fire.

 

Shane

SharePoint Consulting

SharePoint Admin class in Orlando

I sat down to write a blog post but then my VM client decided it wanted to install updates and all of that chaos so I got distracted. Now I am out of time to write a helpful blog post. So instead I will put a quick post here to remind you that I am teaching my SharePoint 2010 admin class in warm Orlando, Florida the week of December 12th. I don’t know about you but Cincinnati (where I live) is very cold that time of year so I am looking forward to a company sponsored get away. Why don’t you come join me?

Shane

SharePoint Consulting

Free Turkey Today!

Update: I am an idiot. Here is the link to sign up. https://www1.gotomeeting.com/register/920583097 


Unfortunately it isn’t the kind you eat it is just more of Shane and Todd’s cheeky shenanigans. In the spirit of Thanksgiving, two of SharePoint’s biggest Turkeys are putting on a free webinar from 3 to 4 PM EST today 11/23/2011. The session will be completely informal where anyone can post SharePoint questions and they will give it their all to answer them. Cranberry sauce not included.


Fine print:


  • The meeting only holds 100 people so first come, first served.
  • When you register the email will come from Citrix. It is very common for it to get caught in junk/spam filters.
  • The session will be recorded but the recording will more than likely not be available after the fact.
  • Be sure to wear your comfy/stretchy pants so you don’t get too stuffed.

We all know you aren’t doing any real work today anyway so you might as well jump into the part.


Shane


SharePoint Consulting


 


PS – Why aren’t you signed up for my admin class in Florida in December? You got somewhere better to be.

Find me at SharePoint Conference

Hopefully your bags are packed and you are ready to head to the Anaheim for the sold out SharePoint Conference next week. I know I am excited. Quickly I wanted to give you a list of my sessions and other events where you can stop by to say hello or heckle (whichever you prefer) next week.

Sessions:

All three sessions will be a good old time. My partner in crime Todd Klindt and I will do our best to entertain and hopefully teach you something along the way.

  • Understanding SharePoint Administration Part 1 Monday 11 AM Marriott: Platinum Ballroom 1-5
  • Understanding SharePoint Administration Part 2 Monday 3:45 PM Marriott: Platinum Ballroom 1-5
  • Planning and Implementing SharePoint 2010 Upgrade and Migration Tuesday 3:15 PM Marriott: Platinum Ballroom 1-5

Post Conference:

No Todd just me but it is a special all day deep dive into SharePoint 2010 administration on Friday. Should be lots of fun. I plan to beat as much knowledge into your heads as possible. The post conference is an additional registration. For more info check out http://www.mssharepointconference.com/Pages/pre-post-conference-trainingpage.aspx#5

Free Books:

Who doesn’t love free books. Todd, Steve, and I will be signing our SharePoint 2010 admin book at a few different places during the week.

  • Monday between 6:30 and 8:30pm we will be at the ESPN Zone at the Idera party signing books.
  • Wednesday at 3 PM we will be at the Rackspace booth. They bought a lot so come get one.
  • Wednesday evening during the Reception in the Exhibit hall we will be signing a few more books at the Rackspace booth.

Random events:

  • Tuesday from 12 to 12:30 Todd and I will be at the Quest booth doing some crazy thing. Some game show. Should be fun and requires audience participation.

At the booth:

SharePoint911 will have a booth as always. Come say hello. We have a whole bunch of fun people to meet there. For more info or pretty pictures of the team click here.

  • Randy Drisgill – MVP
  • Phil Jirsa
  • Todd Klindt – MVP
  • Jennifer Mason
  • Jonathan Mast
  • Raymond Mitchell
  • Larry Riemann
  • Laura Rogers – MVP
  • John Ross – MVP
  • Nicola Young
  • Shane Young – MVP

Even more important? At the booth we will be giving away stress reliever Cows, and two new mystery animals. J Very exciting. Be sure to Moo at anyone in the booth to get the mystery animals.

See ya there!

Shane – SharePoint Consulting

After SharePoint 2010 database attach upgrade alerts have the wrong URLs

Database attach upgrades seem to be the norm these days for customers upgrade from SharePoint 2007 to SharePoint 2010. I am assuming the reason for this is because they are very flexible and generally work pretty well. One of the flexible things about these type of upgrades is you can change your web application URL. Some customers are going from short URL to fully qualified (FQDN) like http://portal to http://portal.company.com. And some of our customers are making complete changes going from http://sharepoint.company.com to http://intranet.company.com. The nice thing about making these types of changes is for the most part a content database has no concept of the web application URL. If you go hunting through the database (which you should never do) you will see everything is relative. The site collections know their urls as / or /sites/sitecollection. That way changing the URL doesn’t matter.

But then there are alerts. Alerts are hard coded to the web application URL that was used to create the alert. This is why if you have multiple URLs for you SharePoint site your alerts may be inconsistent. If your portal is setup so you can access it as http://portal or http://portal.contoso.com then whichever of those URLs you are browsing the site with when you click create alert will be the URL SharePoint sends out in the alerts. Kind of annoying for some people but it is what it is. The real problem comes if you switch URLs.

If you change your web applications URL (maybe during an upgrade but not necessarily) everything will continue to work great except for existing alerts. When you have an alert sent to you it will still have that original URL you used to create the alert even if that is no longer a valid URL. Boo!

Now if you do a Bing search of the internet you will find lots of people point to this TechNet resource http://technet.microsoft.com/en-us/library/cc508847.aspx which will prompt you to create a Windows PowerShell script to fix alerts. One small problem. The script only works to update the URL of alerts for the root site collection. In their script they confuse the web application URL and the site collection URL. To be fair I don’t blame them. When you look at the configuration objects you will see it wants siteUrl and we have been taught that usually inside of SharePoint site = site collection. Unfortunately in this case siteUrl actual means web application URL.

In the beginning when we used their script to update http://portal/sites/old to http://portal/sites/new our alerts had the link as http://portal/sites/new/sites/new/list which has /sites/new twice.

So then I decided to look at things on my own. I created a new alert through the GUI and then used the following script:

Get-SPweb -site http://portal/sites/new -limit all | ForEach-Object {$_.alerts|foreach-object{write-host $_.user $_.properties["siteUrl"] $_.properties["dispformurl"]}}

This gave me a list of all the alerts for the site collection http://portal/sites/new and I saw the value for siteUrl was http://portal. Hooray!

So then I used this script to update just the alerts in that site collection:

Get-SPweb -site http://portal/sites/new -limit all |ForEach-Object {$_.alerts|foreach-object{$_.properties["siteUrl"] = “http://portal/sites/new”;$_.update()}}

Success! But seemed silly to just fix the one site collection so then I wrote a better script that updates the entire web application:

get-spsite -limit all -WebApplication http://portal | get-spweb -limit all |ForEach-Object {$_.alerts|foreach-object{$_.properties["siteUrl"] = “http://portal”;$_.update()}}

<Insert happy dance here!>

Now if you compare my script to theirs you will notice I don’t bother with mobileUrl because no one I know uses it. Also, they rewrite some other properties. If you want to do the same you can piece together the two scripts to do it but for right now for my customers this is working.

Hope this helps

 

Shane

SharePoint Consulting and now SharePoint Training

Using PowerShell to export all solutions from your SharePoint 2010 farm and other fun

Yesterday my client presented a fun little challenge. They have one 2010 production farm they have been using for the last couple of months. On it they have about 25 WSPs that their developers have created. (Insert funny developer joke here. Probably something about a 1000 developers, a keyboard, and creating a Shakespeare novel.) They wanted to move to a new 2010 farm and they also wanted to provision an integration (aka QA or UAT) farm. When I asked for the WSPs they gave me a pile but they were not sure if those were the actual ones deployed in production. Ugh. So instead we decided to figure out if we could extract the actual WSPs from the running farm. Turns out you can, you just need to use my friend Windows PowerShell. J

After a little playing we came up with this to extract them all from the farm.

Extract all of the Solutions from your farm

(Get-SPFarm).Solutions | ForEach-Object{$var = (Get-Location).Path + “\” + $_.Name; $_.SolutionFile.SaveAs($var)}

Quickly let’s see if we can break this down and explain the pieces.

Get-SPFarm does just that it gets your current farm. When I put it in the ( ) that returns the farm. Then I tack on .Solutions which returns all of the solutions in the farm. From there I pipe the solutions over to old faithful ForEach-Object. ForEach-Object says do everything within the { } to each solution passed from the pipe. Within the { } I use $var = to set the variable’s value to Get-Location which returns the current location you are at in the file system. .Path returns that location. (Example output: c:\backupfolder) The + says continue to add to the $var variable. “\” adds a \ to the $var variable. Another + means keep adding to the variable. $_.Name says give me the name property of the current solution. So this ends up setting the value of $var to c:\backupfolder\mysolution.wsp assuming the solution filename was mysolution.wsp and we were running our PowerShell from the folder c:\backupfolder. Finally we have a ; which means we are all done with that line.

We follow up setting the variable with $_.SolutionFile.SaveAs($var). $_.SolutionFile is a property of the current solution. .SaveAs is a method for saving that file. That method needs to know what filename to save the solution to. We give it $var which is the variable we just created.

Boom! Just like that you have exported all of the solutions from your farm to a handy, dandy folder.

Import all of the Solution into another farm

Now because I am naturally lazy I said “I bet we can figure out how to script importing all of those to our farm.” After a little playing turns out you can with the following PowerShell.

Get-ChildItem | ForEach-Object{Add-SPSolution -LiteralPath $_.Fullname}

So how does that work? Get-ChildItem returns all of the files in a folder so if you navigate to the folder you copied over all of the solutions to you return them all. For this example we will say we are in the folder c:\copiedfolder. We then pipe those files over to ForEach-Object so we can do everything within the { } to each object. Add-SPSolution is a SharePoint cmdlet for adding solutions to a farm. –LiteralPath is a required parameter where you need to provide the path to the solution to import. $_.Fullname returns the .fullname property of the object. So in this case it returns c:\copiedfolder\mysolution.wsp.

Oh yeah! Just like that all 25 of those solutions are added to our farm.

Deploy all of those Solutions

So we got this far without me having to type in a bunch of crap so surely we can automate this part also. <he he he> (Keep in mind when I explain the developer crap below it might not be 100% perfect but you get the idea.)

Get-SPSolution | ForEach-Object {If ($_.ContainsWebApplicationResource -eq $False) {Install-SPSolution -Identity $_ -GACDeployment} else {Install-SPSolution -Identity $_ -AllWebApplications -GACDeployment}}

Get-SPSolution is pretty easy that returns all of the solutions in the farm. As a side note there are a lot of properties you can play with here. So you could for example find out which ones are already deployed, in our case we didn’t have any solutions so we didn’t mess with it. ForEach-Object is going to run all of the cmdlets within the { } on each solution. The If cmdlet allows us to evaluate the contents of ( ) if it is true we do the next set of { } if it is false then it will process the { } after the else statement. $_.ContainsWebApplicationResoruces is a true or false property of a solution. –eq checks if the property is equal to $False. $False is a PowerShell system variable that represents false. So this statement checks to see if the solution has web application resources because if it does we need to install the solution a different way. For the solutions that don’t have web resources ($false) we run {Install-SPSolution -Identity $_ -GACDeployment} which is the SharePoint PowerShell cmdlet for deploying a global solution. For the solutions that do have web application resources we run {Install-SPSolution -Identity $_ -AllWebApplications -GACDeployment} which just tells SharePoint to deploy those resources to all of the web applications in our farm. I am guessing you don’t necessarily have to deploy them all to the GAC (-GACDeployment) but this is the way my customer wanted it so I said ok.

When you run the command you should just be returned to the prompt. You can then go to Central Admin > System Settings > Manage farm solutions. Here you will see your solutions and their current status. If you deploy a lot at once it can take 10 minutes or more for them all to go from deploying to deployed but they will. Just be patient.

Hopefully now you feel equipped to go play. Remember the idea here is for you to learn about the moving pieces. Yes my scripts work as is but I am guessing you can take these and massage them to be much cooler. I am just a PowerShell hack who figures out the first solution that works instead of always figuring out how I can refine it to the most efficient, coolest thing ever. J Though I do think I had it worked out to do the import and deploy in one string of commands but we had to return to real work before we finished that part.

Thanks to Todd for double checking me and making the random edits because I suck at English. And thank you to Jeff Jacobs. He was the customer that helped me pound my way through this fun stuff and laid out the challenge.

 

Shane – SharePoint Consulting

Just another Microsoft MVPs site