Tuesday, 26 January 2010

Migrating Team Foundation Server 2010 Beta 2 to new servers

Disclaimer : It worked for me, and I hope it works for you, but do so at your own peril. Make sure everything is backed up and I’d suggest testing on a spare machine first before doing it for real.

We’ve been looking at changing our infrastructure at work and moving from VMWare for our virtual servers to using Windows Server 2008 and Hyper-V. The main server which needed to be moved/converted/migrated between the two different virtualisation technologies was the TFS Server; and hence my domain.

I started off by trying to convert the vmdk file to a vhd file which seemed to work well and could be mounted and the data on it read. However; I was unable to boot from it. After spending, way, too much time trying to get it working I decided to look at the migration exercise. And to be honest it was essentially a disaster recovery exercise as we’d have to go through the same steps if it all went wrong so the time wasn’t wasted.

So after doing a test run on a spare virtual machine we had before the server was taken down I fired up the install for SQL Express and started on the path to setting up TFS. After doing some Googling, and finding loads of different articles which seemed to do bits but not all of it I thought I’d post my findings to hopefully help someone in the future. These are the steps which I came up with. I have also now deployed TFS into the new virtualised production system and it seems to work fine (not got automated builds working yet tho).

Here we go:

  1. Backup databases from old TFS. This includes the Tfs_Configuration databases and any project collection databases.
  2. Build/patch new VM with Windows Server (or other OS)
  3. Install SQL Express 2008 with tools
  4. Restore databases, with the same names, into your new SQL Server instance
  5. Install Team Foundation Server 2010 Beta 2 (and reboot when required)
  6. Run the following command – making sure that you have the correct details in the right places

    c:\Program Files\Microsoft Team Foundation Server 2010\Tools>tfsconfig accounts /add /accountType:applicationTier /account:"NT Authority\Network Service" /sqlInstance:.\SqlExpress /databasename:tfs_configuration
  7. Create a local user named after the server name. So for example if your server is called “TFS” then create a local user called “TFS$” (without quotes)
  8. Fire up the Team Foundation Server admin, go to configure installed components and run the Application Tier only upgrade wizard
  9. Once in the wizard point it to the SQL instance locally and it should find the configuration database, select it and continue.
  10. Finish the wizard and it should be pretty happy. Next thing to do is update the server urls on the main server details page to point to the new server name (as it’ll have the old server name in it)
  11. Start up the project collection(s) and throw in a server restart for good measure.
  12. Done!

You should now be able to connect to the server through Visual Studio as before. You will need to add in the new server details (and remove the old). I found all the workspaces where fine and all was good to go.

With a big team its probably wise to get everyone to shelve all their changes over a weekend or evening and make sure nothing is checked out. But this is down to preference and may need to be tested.

Hope this helps someone in the future :-)

Saturday, 9 January 2010

Cheap remote backup solution

After reading the madness of what happened to Phil Haack a few weeks ago and a few other people who had VPS’ running on the same machine after a physical hard drive failure everyone on the box (so it seemed) realised that they didn’t have much, if any, backup solution in place. This got me thinking …

There are a number of remote backup solutions for remote servers but they cost money which at the current time I don’t have, and most people don’t have due to the current economical climate. So was checking my email the other day and scrolled to the bottom of the page and noticed that I was only using a small amount of the my gmail account storage. It got me thinking that there was a plug in you could get to use your gmail account a remote storage / mapped network drive. This could be the reliable backup solution I’m looking for.

After doing a bit of Googling about to see if there was anything out there before I set down to write my own solution to this problem I found backup2Gmail on Code Project. Once I realised that you could run this from a command line then I was on to a winner.

So the backup bat file goes along the lines of:

Backup the svn respository using svnadmin to a backup folder (c:\backup\svn)

Checkout the latest code from the repository to a folder in the backup folder (c:\backup\code)

Run the backup 2 gmail command line to backup the c:\backup folder. It then zips it up and sends it to my account.

And that’s it. Put all that into a bat file, put some error checking in to make sure the dirs which are required are there at the beginner, removed at the end etc. and then set it as a scheduled task for some crazy time early in the day (currently set at 3am).

Hope this helps someone else in the future to avoid the heart ache of server failure.

Thursday, 7 January 2010

Map network drive in code

I needed to programmatically map a share drive to access files for a asp.net web application. This works on the app pool identity and doesn’t have mapped drives by default so after a little Googling, I found this :


It maybe a few years old, but works like a dream!

Wednesday, 6 January 2010

A device attached to the system is not functioning

I rebooted my windows 7 machine yesterday and could successfully remote desktop to it. I then disconnected from the session as I had some things running and wanted them to continue to run. When I try to re-connect tonight I get :


Any ideas what this means?

Edit: Tried running remote desktop from the command line with the /console option and that doesn’t resolve the issue either :-(

Friday, 1 January 2010

End of 2009 – General thoughts, musings and diet updates.

Well the end of the year is upon us and I think it’s time I reflected a little on what’s happened diet wise, fitness wise and a little in general.

First time in a while the exercise has been above and beyond the beer intake. With this and the diet that I’m undertaking with my wife the weight has gone down slowly yet steadily which is good. At least this way I am more likely to keep it off. I’m also feeling a lot healthier now that I have lost some weight and generally eating better. Improving what we ate (using Weight Watchers cook books) the food has been filling, tasty and yet not fatty or loads of points.

At least once a winter period I go down with a stinking cold, I don’t get the flu as I have the inoculation every year, and it hits me for 6 for a few weeks at a time. Since going to the gym regularly and eating better I have felt great for the past few months not being worse than a bit of a blocked nose, until now. Ah well, hopefully will start feeling better when I get back into the swing of things with gym, food and work on Monday.

I’ve been impressed that I’ve managed to keep the weight off as well and I feel good for it. Only downside is the bits they don’t tell when you’re on a diet like you’ll feel the cold more as you don’t have so much podge to keep you warm! Below is the graph of weight loss since the start of the diet. As you can see it’s been a bit poor over the festive period but will get it back on track in January.


As for work related stuff, it’s been up and down this past year as I’ve posted before, but I am looking forward to the new year and what it will bring. I’ve got a lot of things planned both work and external related and I look forward to implementing most if not all of it. Also in the new year I will be posting more disc golf related content as well as more coding and design posts. I hope you enjoy!

Right, last bit to do is the first thousand beers update …

Current weight loss (since Aug) : 13 3/8lbs

Current Status : Bad! (-94.8)
Beers: 386 + 75 =  461
Miles: 97.3 (gym: 64.3; road: 33) + 65.2  = 162.5
DG Rounds: 62 + 5 = 67 
Gym visits: 70  + 12 = 82
Lengths : 51 (total: 512) + 35 =  547 => 54.7
Good => Exercise > Beers
Level => Exercise == Beers
Bad => Exercise < Beers