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

PowerShell doesn’t show all of your SharePoint 2010 content databases

Today SharePoint managed to freak me out for a few minutes. I was looking at a customer’s farm and when I ran the PowerShell cmdlet Get-SPContentDatabase it was only returning one content databases even though my farm has two content databases. The output looked like this.

So then I thought about it and figured I had the problem where the account I was logged in as didn’t have access to the other databases. So then I grabbed Todd’s blog post on How to create a SharePoint 2010 admin account and stop using sp_farm because I knew it would jog my memory on how to give my account access to the databases. I ran through it and I still got just the two databases. UGH.

So then I figured when all else fails try Central Admin. When I went in to manage content database sure enough they were all there. But then that is when I saw a clue. The content database I couldn’t see was “Stopped”.

Surely that isn’t the issue? But I try anyway. I quickly set the database back to started and then run my PowerShell again.

That fixed it. Well, I guess you learn something new every day. The more we play with it the more it seems to be a lot of little things that happen when you leave a database in the stopped/offline state. I think as a rule of thumb leaving databases in this state is a bad idea. Some of the weirdness we have seen is with timer jobs, like the profile sync job, don’t run against those databases.

Why do people leave databases in the stopped state?

The main reason people do this is because they do not want any additional site collections to be created in that content database. And that is admirable goal if you are trying to control database sizes. The key is the better way to accomplish this is to set the maximum number of site collections to the current number of site collections. Same result without weird behavior like this.

Another way to see all of the content databases regardless of state

This comes from one of my developers named Jonathan Mast. He suggested instead of using Get-SPContentDatabase that I use Get-SPWebApplication | ForEach {$_.ContentDatabases} | Select Name to get all databases regardless of state. That works pretty well.

Todd would like you to know

If you use Get-SPDatabase | Select Name, Status SharePoint will give you a wonderful list of all of your SharePoint databases (config, services, and content) and show you their status. In this case my mystery database would have shown as Disabled. Another nice trick when fighting through a problem like this.

Hope this helps

Shane – SharePoint Consulting

A new SharePoint training company

Who could it possibly be? It’s SharePoint911, of course! I can hear it now: “But don’t you guys already do training?” Actually, the majority of our team has done SharePoint training for years, but for the most part we have we have done it under the umbrella of other training companies. We have written at least 10 different classes for these different companies, and we have taught 1000s of students over the years, but always for someone else.

For the first time ever, we are creating our own training content and we have 100% control. No more creating modules to fit a specific format or marketing objective. After talking to a customer who got an early preview of the outlines, his exact quote was:

“I love the content. When you read the training page you can feel the passion you guys have for SharePoint and you get a good sense of the high level of experience.” –Andrew Post, MCSE, MCP

That is exactly what I wanted to hear! These classes are written and taught from the heart.

And because I believe you should always lead with your very best, the first-in person SharePoint 2010 administration class will be designed, written, and taught by Todd Klindt and yours truly. Go read the outline. It isn’t marketing speak or hot air; it is all of the stuff that Todd and I are dying to talk about. We also created the outline in the opposite order of most – we wrote down everything we wanted to cover, and then cut it down to make it fit neatly in five days, and put it in a logical order. Through dumb luck we ended up with 15 modules.

The first teaching of the class will be in Cincinnati, Ohio from April 4 – 8, 2011. And because it will be the first class, we are offering a $500 discount. So instead of the normal price of $2,999 you will only pay $2,499. How can you pass up a deal like that?

If that weren’t enough, we are also offering online classes. These will be live, 75-minute sessions taught by subject matter experts from our team. These are taught in the same style as we use for our internal training. That means no “death by PowerPoint.” Instead, you’ll get hard, fast information that you can take action on right away. Heck, I think one of the classes doesn’t even have slides, but instead will be 100% demo on building a solution. Awesome. You can find a complete list of everything about our training and the upcoming classes here.

That is enough to get us started, but don’t worry. The training division of Sharepoint911 is going to grow very rapidly. We have several ideas for upcoming classes that no one else is offering to make you the biggest and badest SharePoint Ninja on the block.

Thanks

Shane

SharePoint Consulting & now SharePoint Training

Search Database GUID issue

So in the quest to have no GUIDs I wrote the blog post How to remove the GUIDs from the SharePoint search service application databases to great fan fair. After reviewing my VM and other servers I have performed the steps on I have found the error message below. (Text and image included to help with the search engines getting you here.)

SQL Database ‘NewSearch_DB_e28b777e4e664c479879f5a257b932f9’ on SQL Server instance ‘CowTown’ not found. Additional error information from SQL Server is included below.

 

Cannot open database “NewSearch_DB_e28b777e4e664c479879f5a257b932f9” requested by the login. The login failed.

Login failed for user ‘CONTOSO\sp_farm’.

(Don’t make fun of my server being named CowTown.)

So that seemed kind of scary but made sense because I had deleted that old database. After digging around I found that search seemed to work fine and apparently one of the timer jobs was just trying to check this database once an hour. So first thought I had was “I wonder if SharePoint still thinks that is a database somewhere even though the Search service application isn’t using it?”

Well, I know PowerShell to find out the answer to that question. I opened up a SharePoint Management Shell and simply ran:

Get-spdatabase

Which gave me the output below:

Sure enough. The old database is still listed even though Search isn’t using it. UGH. (Fifth database from the bottom.)

Another place I saw it that was kind of freaky was Central Administration > Upgrade and Migration > Review database status

Here you can see that it is listed as Not Responding. UGH.

So all of this makes sense. We did delete the database because Search doesn’t use it anymore. Now we just need a way to tell the farm to quit trying to reference it. I fought with about 3 different ways to make this work and finally I came up with this one which I believe should be completely supported. J (My other ways may have been a little too direct.)

Getting rid of the error

  1. Open the SharePoint Management Shell
  2. Type get-spdatabase and press enter. This will give the output below.

  3. Find the database in question. You need to then copy the Id for it. You can right click in PowerShell and choose mark.
  4. Type $bad = get-spdatabase <your id> and press enter.

  5. Type $bad and hit enter. This will show you the database you have in the variable. It is your last chance to double check you got the correct database.

  6. Type $bad.Delete() and press enter. No more database.

  7. Type get-spdatabase and press enter. All better.

At this point all of your worries are gone. No more stupid error message. Standard precautions try this in your test world first. You are up a river without a paddle if you do this for the wrong database since it is a pretty violent way to delete the database.

May the force be with you!

Shane

SharePoint Consulting

Rename the SharePoint 2010 PerformancePoint database to remove the GUID

When I build a farm with the intention of not having any GUIDs I use the Central Administration page Manage Service Applications to create most of my service applications. And for most of the service application that have databases the GUI gives me the chance to name the database, which means I can avoid having those gosh darns GUIDs. There are two service apps that don’t play nice with this strategy Search and PerformancePoint Services (PPS). I covered how to do the Search rename so now it is time to get rid of the PPS database GUID.

Thankfully this is pretty straightforward.

First I went into Central Admin > Manage Service Applications and clicked New > PerformancePoint Service Application. I named it Blog PerformancePoint Service App

If I jump over to SQL I now have the highlighted database

Completely unacceptable.

So now what?

Rename the PPS database

  1. Go to SQL Management Studio and rename the database
    1. Open SQL Management Studio. You may have to go to your SQL Server to do this.
    2. Attach to the instance that host SharePoint
    3. Find your database
    4. Right click on the database name and choose Rename

    5. Delete the GUID off the end of the name or make the name whatever you want then press Enter. SQL Database is now renamed. Notice I changed all of the spaces to underscores. Why? Because DBAs hate spaces in names more than they hate GUIDs and I am a nice guy.

  2. Now go to your SharePoint Server and use PowerShell to set the database name.
    1. Click Start > All Programs > Microsoft SharePoint 2010 Products > SharePoint 2010 Management Shell. If you have UAC enabled be sure to run it as Administrator.
    2. Then run the following line. Be sure to replace your info for service app and database name.

Now you can celebrate you have saved the world another GUID. I have a master post here with all of the anti GUID posts linked in one place. Right here.

 

Shane

SharePoint Consulting

    

Getting rid of GUIDs in SharePoint 2010 database names

It is like your typical battle of good vs. evil. SharePoint 2010 has a secret plot to run the world out of GUIDs and between you and me I think it has a good shot of accomplishing its goal. Well, me and boy wonder (aka Todd) have seen the pain and suffering they are trying to evoke and we have plan to stop it. Creating blog posts to remove as many of the GUIDs as possible.

“But dynamic duo who cares if the world runs out of GUIDs?” Well, to be honest the people it scares the most are the poor developers. And while we generally consider developers second class citizens that doesn’t mean we wish them harm. And let’s face it, if they didn’t have GUIDs they would have nothing to do. And we all know bored developers will wander the halls of your office building aimlessly. Or worse they will congregate in places like the break room and will want to make small talk with you when you go to get an afternoon Mt. Dew. I don’t know about you, but nothing ruins my day worse than idle chit-chat with a developer. Yucky.

So this post is your one stop shopping for everything about getting rid of the GUIDs: As Todd or I post new items for removing GUIDs we will update this post.

How to get rid of the Central Admin database GUID by Todd

How to get rid of the SharePoint 2010 Search service application database GUIDs by Shane

How to clear timer job error after renaming the Search Admin database by Shane 

Microsoft article on renaming databases (Be careful, it isn’t perfect yet)

How to rename the PerformancePoint Database by Shane 

Build your farm without getting GUIDs in the first place by Todd

As always remember to test any of these steps on a nonproduction server before attempting on your real servers.

Save the GUID!

Shane

SharePoint Consulting

PS – I don’t hate developers. Really, it just seems that way.

SharePoint 2010 database attach upgrade with managed paths

This week I found a new to me issue with doing a database attach upgrade from 2007 to 2010. It seems if your 2007 content database has additional wildcard managed paths (anything other than /sites) that when you upgrade that database to SharePoint 2010 that you will end up with a bunch of explicit managed paths in SharePoint 2010. Kind of break downs like this:

2007 Wildcard managed paths:

  • /sites
  • /departments
  • /projects

2007 site collections in the content database:

  • /
  • /sites/teamsite
  • /departments/hr
  • /departments/accounting
  • /projects/CowMachine
  • /projects/CowNinja

When you create a new 2010 web application and attach the content database you will get the following managed paths:

  • /sites – wildcard
  • /departments/hr – explicit
  • /departments/accounting – explicit
  • /projects/CowMachine – explicit
  • /projects/CowNinja – explicit

And of course all of your site collections will be available.

As you can quickly tell this is way less than ideal. For one when you try to create a new site collection for the Cow Black Ops project you will not be able to create it at /projects/BlackOpsCows because there is no longer a managed path for /projects. Boo! So how do you fix it? About time you asked.

Create managed paths before attaching 2007 content databases

The fix here is quite simple. Know your managed paths you need before you do your upgrade. Then right after you create the 2010 web application and before you do the mount-spcontentdatabase you need to go into Central Admin > Web Application management, click your web application and then from the ribbon select managed paths. Now create your wildcard manage paths. In this example you create /departments and /projects. Now return to your regularly scheduled program and do your 2007 content database upgrade.

If you already find yourself with this issue the fix is as simple as you are assuming. Go into central admin > manage content databases and remove your upgraded databases. Once they are detached go delete all of the explicit managed paths for your database. Then create the wild card paths you want. Now reattach your content database. All better. J

Hope this helps

Shane

SharePoint Consulting

« Previous PageNext Page »