Tuesday, July 28, 2009

Installing Visual Studio 2008 Service Pack 1

Recently, I realized that a few of our developement servers were running Visual Studio 2008 with the beta of SP1. One would assume that the installation of a service pack wouldn't be too difficult but since they already had the beta of service pack 1 installed, the installation of SP1 became a bit more complicated.

If you download the service pack installation file from Microsoft and run it, you get an error saying that you need to run the Service Pack Preparation Tool before being able to install. Head to the Microsoft website and download the removal tool.
In my case, I ran the SP prep tool and received yet another error. It said that it need some files on the installation disk for Visual Studio 2008 Shell (integrated mode) - ENU. The ticket here is that we don't have a disk for that and to my knowledge, there isn't one. Microsoft has a download for it but it's an executable that doesn't extract an iso. I searched around for a solution to the problem and found a site that said to simply uninstall VS 2008 Shell (listed in Programs and Features as Microsoft Visual Studio 2008 Shell...). I performed said action and the prep tool ran fine with no errors.
After running the prep tool, I stimply ran the installer for the service pack with yet again no errors.
The install did, however, take about two hours (ugh).

There you have it.

Monday, July 27, 2009

Server Administration : Firewalls

Hello again all,

The majority of the servers that I manage have to communicate with many other servers I manage for various reasons. Inevitably, I have many firewall blocking issues. Despite my age, I still have trouble remembering all of those commonly used ports and what they are for. That being said, this post will list all of the Windows default firewall ports used for the various software sources. Yes these are all readily available at other sites. This is simply a central collection.
I will update this post when I have more blocks come up.
Post comments if you would like to have a particular port added to the list.



FTP

21

HTTP

80

HTTPS

443

POP3

110

SMTP

25

SQL Server Management Studio (remote connect)

1433

Terminal Services

3389

VMWare Server Administration

8222

VMWare Server Administration (Secure)

8333



Let me know in the comments section if there are any ports you would like added to this list.

Wednesday, July 15, 2009

Installing Team Foundation Server 2008

The installation of TFS 2008 can be a daunting task if the right documentation is not used. This post will cover the installation of Team Foundation Server 2008 and all of its prerequisites.

To preface, this post will document a single server installation of Team Foundation Server 2008 on a Windows Server 2008 server using SQL 2008 on the backend.

Here’s the quick rundown of what will be done.
1.) Install IIS 7.0
2.) Install SQL Server 2008
3.) Install SharePoint
4.) Install Team Foundation Server 2008

*NOTE* Before the install of Team Foundation Server you must have service pack one integrated into your install media. Microsoft has outlined how to integrate SP1 into your install media here.

To save text space on each installation process, I will be simply saying where to go to install the specified software rather than doing a step-by-step tutorial.
Lets get started


Installation of IIS 7.0

Here’s a good one. To install this one, head to the Server Manager window. From there, go to install the IIS 7.0 Role (it is called Web Server (IIS) in the wizard). When you select it to be installed, you will be prompted to install two more features additionally, assuming this is a clean install. Accept the install of the two additional features and continue.
The role services that need to be installed are:
1.) HTTP Redirection
2.) ASP.NET (Add required role services as well)
3.) IIS 6 Management Compatibility
Click through the windows until IIS 7.0 is installed. Though it is not required, I always do a restart after the installation of a new role or service, just to be safe.


Installation of SQL Server 2008

Yet another exciting step (like every step in this process) is the installation of SQL Server 2008. Insert the DVD (or mount the iso) and run the setup.exe on the disk. Select the New SQL Server stand-alone installation or add features to an existing installation option under the Installation page.
Enter your license key on the window that comes up and proceed through the various prompting windows until you get to the Feature Selection screen.
The features that need to be installed are:
1.) Database Engine Services
2.) Full-Text search
3.) Analysis Services
4.) Reporting Services
5.) Management Tools – Basic
For the Instance Configuration, the Named instance field can be anything. I personally use the default instance and Instance ID for simplicity.
For Server Configuration I used the NT AUTHORITY\NETWORK SERVICE “account” for all of the services. Also make sure that SQL Server Agent starts up automatically and not manually. The other three should be automatic startup by default.
On the Database Engine page the Microsoft documentation suggests Windows Authentication. I believe that that method for authentication has it’s purposes but for my purposes, I use Mixed Mode authentication. Don’t forget to add the user(s) you want to have sysadmin access to your SQL instance. If you forget this step, you won’t be able to get into your instance unless you find a way to enable the SQL SA account without having to authenticate.
Add the users you want to have access to the analysis services on the Analysis Services Configuration page and continue.
For the Reporting Services Configuration page, select to Install, but do not configure the report server. The Team Foundation Installer will do this for you later.
For the last few pages, just click through them (make sure to check if you want Microsoft to receive usage reports from your instance). Review your install to make sure everything is as it should be and install SQL server.

Popcorn anyone?


Installation of SharePoint Products and Technologies

Before the installation of SharePoint, we need to do a prerequisite install. Head to the Server Manager and add the .NET Framework 3.0 feature. On my server instance, this was actually already installed so I didn’t need to install it. Simply make sure that you have it installed or you will run into problems later on.
Now, for the installation of SharePoint Products and Technologies.
Head to the appropriate link to download download Windows SharePoint Services 3.0 with Service Pack 2.
x86
http://www.microsoft.com/downloads/details.aspx?familyid=EF93E453-75F1-45DF-8C6F-4565E8549C2A&displaylang=en
*NOTE* The link to the x64 version of this is not listed because there is not a 64 bit version of TFS 2008.

*NOTE* If you choose to go with an alternative installation package, it must at least have service pack 1 already integrated.

Run the SharePoint.exe file to get started with the installation.
After accepting the license agreement, we find ourselves at a fork in the road. Select Advanced to do a customized install. The server type should be Web Front End. On the Feedback tab decide whether or not to share usage reports with Microsoft. Click Install Now.
After the installation has completed, Make sure the Run the SharePoint Products and Technologies Configuration Wizard now is checked and click Close.
In the Configuration Wizard, Select No, I want to create a new server farm and click Next.
For Database server type the name your database is hosted on. In the case of a single-server install of TFS, this will be the hostname of the server that you are installing SharePoint on.
*NOTE* If you chose a name for your SQL instance other than the default instance name, type <ServerName>\<InstanceName>
Choose the name of the SharePoint database or leave it default (I used default).
Input the username and password for the service account (can be the TFSService account) and click Next.
On the next page, be sure to remember the port you choose for your Central Administration web application. It can be recovered relatively easily but it’s just best to remember now. Select NTLM and click Next.
Review your settings and finalize the install.
Finally, we need to run a few command line commands.
Open a command prompt as admin and navigate to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin\.
First, run
stsadm.exe -o extendvs -exclusivelyusentlm -url http://<ThisServersName>:80 -ownerlogin Domain\Username1 -owneremail "admin@localhost" -sitetemplate sts -description "Default Web Site"
Domain\Username1 should be the account you want to have admin privileges on the port 80 SharePoint web application. I used mixed authentication so I gave this the service account for TFS and SQL.
Next, run
stsadm.exe -o siteowner -url http://<ThisServersName>:80 -secondarylogin Domain\Username2
In this case, Domain\Username2 represents the user you want to be your secondary administrator for your SharePoint port 80 web application.


Installation of Team Foundation Server 2008

*NOTE* Once again, Before the install of Team Foundation Server you must have service pack one integrated into your install media. Microsoft has outlined how to integrate SP1 into your install media here

Welcome to the final step in this installation process (TFS 2008 configuration will be in a different post). I won’t slow us down with any detailed intros. With that, let’s get started.
Insert your installation medium (once again, I used an iso mounted through Hyper-V). Start up the installation, agree to the TOS (if you actually do) and head on to the next screen. After clicking Next a few times, you’ll find yourself at the Team Foundation Database Server page. As I mentioned earlier in the post, I’m doing a single server install this time which means my TFS database is hosted on a local instance of SQL. The installer should fill out the local server name for you. Since we’re doing a single server install, click Next. Sit back and relax for a few minutes while the installer runs a System Health Check.
Once the health check is complete, click Next to head to the Team Foundation Server Service Account screen. Once there, specify the account you want TFS to run as. In my case I chose a domain account for access reasons. Click Next.
On the Reporting Services Data Source Account screen, input the information for the account you want TFS to run reports as. In my case, I elected to go with Use Team Foundation Server service account since my SQL reporting runs as that user. Click Next.
The installer should automatically fill in the information for you on the Windows SharePoint Services screen. In my case though, the Central Administration URL was incorrect for some reason (the port was one number off) so make sure that everything is right before continuing. Click Next.
Here we are at the Specify Alert Settings page. If you wish TFS to notify you (or anyone else) of various build events (this is configurable), check the Enable Team Foundation Alerts checkbox and fill in the information for SMTP server and From e-mail address fields. Click Next.
On the Ready to Install page, review your settings. If everything is correct, click Install.


There you have it…a fresh install of Team Foundation Server 2008.


Tuesday, June 30, 2009

Migrating SQL Data

In my current project I have found a need to migrate data from one SQL server to another. For those of you SQL gurus out there, you know that there are many ways to migrate data from point A to point B in SQL, even when different versions is involved.

Here's my setup
Server 1:
SQL Server 2005 Standard (x86)
Windows Server 2008 (x86)

Server 2:
SQL Server 2008 Standard (x64)
Windows Server 2008 (x64)

As you can tell, I'm upgrading versions and processor architectures. Surprisingly enough, this didn't seem to cause any issues for me.

Here are a few options one has to migrate SQL data between servers for those who don't find this post too useful.
1.) SQL Copy Database Wizard
2.) Detach, copy to new server, and reattach
3.) Backup database, copy backup to the new server, convert backup to a database, attach the converted database
4.) Create a database mirror
5.) Duplicate the database structure on server two and import the data from server 1

For my environment, only 1, 3, and 5 would work since the others leave more possibility for data integrity issues during the transfer or require that the SQL server be temporarily taken offline. I tried out a few of my options and decided that 1, the SQL Copy Database Wizard, was the best option. It's relatively straightforward and very efficient.
For the last three days I have been struggling with it because of what looks like permissions issues, though I can't be sure since all the error says is that step 1 was the last step to run and that the job failed (give me ambiguity or give me something else!). All that being said, I decided I needed to find a new way to transfer the data.

Through all of my troubleshooting I found quite a few SQL facets that I pieced together to get what I needed. Here's how I chose to migrate my 12 databases without too much trouble.


To start, I used SQL Server's remarkable "Script Database as" functionality to write out the query that creates the database, all of the columns, and all of their constraints. For mine I just copied the script to the clipboard to make compiling all of the scripts together much faster. To sum it up, I had SQL generate the queries for each database I wanted to migrate and I pasted them all into notepad so I could run them all at the same time.







After running all of the afforementioned queries to create the all of the database structures on your destination server we're ready to start importing data. Right click the database to import data to. Go to Tasks -> Import Data...













If you haven't done this before, you should receive a "Welcome to the SQL Server Import and Export Wizard" screen. Click Next.


Here we are at the "Choose a Data Source" screen. For Server name type the hostname of the server you need to migrate from (the source server). After that, select the database you want to copy to the new server. Once done with that, click Next.














On the "Choose a Destination" screen, type in the name of the server to migrate the data to. Next, select the Database you want to copy the data to (this should corrospond to the DB name on the source server since we ran the create queries generated by SQL). In my case, I was running the Import and Export Wizard from the server I was importing the data to so SQL server already had the Server name and Database filled out. Click Next.

In my case, I wanted to copy the entire database to the destination server, so for the "Specify Table Copy or Query" screen, I elected to "Copy data from one or more tables or views". Click Next. On the following screen, check all the database tables you want to be copied (or just check the box at the top left for all of them).

Nearing the end the "Save and Run Package" screen comes up. If you don't need to save the package to be run later or again at a later time, just leave Run immediately checked and click Next. Finally we review our settings and what will be copied. If everything looks right, click Finish. Once the transfers have completed, click Close. If any transfers failed or threw a warning, you can click the "Messages" text next to the table that did not succeed to see the log entries about it.

Repeat the aforementioned steps until you have migrated every database you need.

Thursday, June 25, 2009

Converting Hyper-V VHDs

I recently was assigned the task of rebuilding our Team Foundation Server with TFS 2010 for many reasons. One of those is because the old one has a VHD that is consuming far more resources than it should be (it's a 100 gigabyte vhd and only 8 gigabytes are in use). I seemed to recall somewhere that Hyper-V could "compact" a virtual hard drive, but I couldn't remember where. After doing a bit of searching around Hyper-V, I found what I needed.

Here's a few facts about this before getting started.
First, shrinking a hard drive only applies to Dynamically sizing disks. Since these do no shrink on their own (there's a lot of reasons why) but only grow, they might need to be compacted later to free up host space. It only reduces the .vhd file size by shrinking the 'shell' (if you will) to take up the drive space that is not being used by the guest OS.

In my situation, I was dealing with a drive that was not dynamically sizing but was static. If the vhd is static, the Compact button will not show up when you go to edit the drive.
In my case, I did not have to compact the drive. As I said, a drive cannot be compacted unless it is dynamic. Since mine was static, I converted it to dynamic to regain the compacting functionality but because of the way the conversion process works, it automatically 'compacts' the .vhd. My original static .vhd was 100 gigabytes. The output was 15.5 gigabytes.

Though I did not have to compact my .vhd because the conversion process did it for me, I'm going to put the instructions on how to compact the .vhd anyways.

For starters, the virtual machine that the hard drive is attached to must be turned off. Once the server is offline, from within the Hyper-V Manager (it's an mmc snap-in) go to the virtual machine's properties (right click the machine and select properties). Select the drive you want to shrink on the left panel that lists the various devices attached to the virtual machine. After selecting the drive, on the right panel, select Edit. This will bring up a window that tells you what editing a drive does and gives you the option to not show that screen again. Click Next. From here you should have three options (unless the .vhd is static). Select Compact and click Next. Finally, click Finish and Hyper-V Manager will shrink the .vhd as much as it can.