Hands-Free TFS Install - Part 3 - Installing Team Foundation Server unattended

This blog post is part of a 4-part series. The other parts are:

Introduction

In part 3 of 4 of my Hands-Free TFS Installation series, I’m going to cover two things:

  • How to perform an unattended installation of TFS, and
  • The shortcomings of the TFS installers

If you’re only interested in building a server once, or you just want a repeatable process for doing so, this is the part for you. Before you start this part, you may want to read Part 2 on Building the ISO - as the file paths all relate to this.

As you should know from reading the latest version of the Visual Studio Team Foundation Installation Guide, there are a number of steps that must be performed before you can start installing TFS. It’s not a simple “throw in the DVD and run setup.exe”.

The steps that I will be covering in this post are:

  • Creating user accounts with appropriate permissions
  • Installing SQL Server 2005
  • Installing SQL Server 2005 SP2
  • Installing Windows SharePoint Services 2.0 SP2
  • Installing .NET Hotfix (913393)
  • Installing a Single-Server TFS
  • Installing Team Explorer (the TFS Client)
  • Installing TFS SP1 + Hotfix
  • Installing Team Suite SP1 (to patch Team Explorer)
  • Installing Team Plain Web Access

Creating user accounts with appropriate permissions

This is easily scriptable. The two commands we will use are:

  • the “net.exe” command from C:\Windows\System32
  • the “NTrights.exe” command from the Windows 2003 Resource Kit

First of all, we create the 2 additional user accounts to the TFSSETUP user account.

net user TFSSERVICE * /DOMAIN /ADD /EXPIRES:NEVER

net user TFSREPORTS * /DOMAIN /ADD /EXPIRES:NEVER

Some notes on the syntax:

  • The ‘*’ parameter signifies that we want to be prompted for a password. You could enter a password here and not be prompted.
  • The ‘/DOMAIN’ parameter signifies that it’s a domain account we’re creating
  • The ‘/ADD’ parameter signifies that it’s a new user
  • The ‘/EXPIRES’ parameter signifies when the account password should expire. Since this is a service account and we want to avoid the operational headaches of changing passwords, we set this to ‘NEVER’. Your situation may be different.

Assigning appropriate permissions

The service accounts used need to be given the ‘Log on as a service’ right. This is usually configured by going to Control Panel | Administrative Tools | Local Security Policy | Computer Settings | Security Options | Allow Log on as a service.

This can also be done from the command-line with the following commands.

ntrights -u TFSSERVICE +r SeInteractiveLogonRight

ntrights -u TFSREPORTS +r SeInteractiveLogonRight

See How to Set Logon User Rights with Ntrights.exe for more information.

Installing SQL Server 2005

Fortunately the TFS media includes a setup answer file for installing SQL server. This means that we can run an unattended installation with no user input.

The answer file is called ‘SQL2005ForATDT.ini’ (for a single-server installation) and it’s located in the root of the TFS media. However in our case, we’re using a custom ISO file, so it’s in a subfolder.

The other thing to consider is that you need the \Servers directory AND the \Tools directory for SQL setup to succeed without warnings. This is because the answer file installs the SQL 2005 management tools.

The command-line for installing SQL is:

D:\SQL\Servers\setup.exe /qb /settings D:\TFS\SQL2005ForATDT.ini

Installing SQL Server 2005 Service Pack 2

Unfortunately SQL Server 2005 does not support slipstreaming of service packs (see connect). That means that you have to run the SP2 installer which takes almost as long as the initial installation!

The good news is that this is seen as “key functionality and planned in the next major release: SQL Server 2008“, so this will reduce installation times considerably.

Now before we install SP2, we need to stop the SQL Browser service, set it to automatic startup and start it later. So the steps become:

sc stop SQLBrowser

sc config SQLBrowser start= auto

D:\SQLSP2\SQLServer2005SP2-KB921896-x86-ENU.exe /quiet /allinstances

sc start SQLBrowser

Installing Windows SharePoint Services 2.0 SP2

This one is a no-brainer. No unattended script required, just command line parameters.

D:\WSS\stsv2_ENU.exe /C:”setupsts.exe /remoteSql=yes /provision=no /q”

We also ensure that NTLM / Integrated authentication is in use.

cscript C:\Inetpub\AdminScripts\adsutil.vbs set w3svc/1/NTAuthenticationProviders “NTLM”

Installing .NET Hotfix (KB913393)

Another easy one. We use the standard “/q” parameter for a “quiet” install. More on this later.

D:\TFS\KB913393\NDP20-KB913393-X86.exe /q

Installing a Single-Server TFS

Up until this point everything has been Hands-Free. Unfortunately the TFS server bits can’t be installed without the GUI. So we start the wizard, fill in our service accounts and passwords, configure SMTP settings and let it run.

We also use the “start.exe /wait” command so that our batch file waits for setup to complete before continuing.

start /wait D:\TFS\atdt\setup.exe

Installing Team Explorer (the TFS Client)

I always find it useful to have Team Explorer installed on my TFS servers. There are two reasons for this:

  • It’s useful for configuring user permissions and debugging builds, etc.
  • Team Explorer includes the Microsoft.TeamFoundation.* assemblies which many third-party tools rely upon.

Unfortunately it’s a GUI installer as well. Aaron Stebner has written a blog post on How to perform a silent install of Visual Studio 2005 Team Explorer. Although I could’ve made this a silent installation it’s not officially supported, so it’s best not to.

The command-line becomes:

start /wait D:\TFS\tfc\setup.exe

Installing TFS SP1 + Quiesce-GDR Hotfix

Two more easy installations using the standard “/q” for “Quiet” installation.

D:\TFS_SP1\VS80-KB919156-v2-X86.exe /q

D:\TFS_SP1\TFS_SP1_VS80sp1-KB926738-X86-ENU.exe /q

Installing Team Suite SP1 (to patch Team Explorer)

Although I’m not 100% sure on whether this is required or not, I thought it would be a good idea to install the Visual Studio 2005 SP1 patch to patch Team Explorer.

This is a mammoth path and can take quite some time to install if you have the full Visual Studio Team Suite installed. Fortunately Heath Stewart comes to the rescue with his blog post on Save time and Space for VS 2005 SP1 by disabling the patch cache.

reg export HKLM\Software\Policies\Microsoft\Windows\Installer %temp%\installer.reg

reg add HKLM\Software\Policies\Microsoft\Windows\Installer /v MaxPatchCacheSize /t REG_DWORD /d 0 /f

net stop msiserver

start /wait D:\TFS_SP1\TeamSuiteSP1_VS80sp1-KB926601-X86-ENU.exe /q

reg delete HKLM\Software\Policies\Microsoft\Windows\Installer /v MaxPatchCacheSize /f

reg import %temp%\installer.reg

net stop msiserver

del /q %temp%\installer.reg 2>nul

If your server doesn’t have enough “contiguous virtual memory” available, the patch installation may fail with:

Error 1718. File Filename was rejected by digital signature policy.

See this KB925336 article for more information.

Installing Team Plain Web Access

The last installation step we want to perform is Team Plain Web Access (or whatever it gets renamed to in the next release).

Unfortunately the v2.0 RC doesn’t support unattended installation, so we run the GUI.

D:\WEB\TeamPlain-Web-2.0-RC.msi /q

The script

So putting it all together, we end up with the following script. Remove the pauses once you confirm that it works for you.

SET TFSSERVICEPW=strongpassword

SET TFSREPORTSPW=strongpassword

:: ############# User accounts

net user TFSSERVICE %TFSSERVICEPW% /DOMAIN /ADD /EXPIRES:NEVER

net user TFSREPORTS %TFSREPORTSPW% /DOMAIN /ADD /EXPIRES:NEVER

ntrights -u TFSSERVICE +r SeInteractiveLogonRight

ntrights -u TFSREPORTS +r SeInteractiveLogonRight

pause

:: ############# SQL 2005

:: # Run SQL2005 setup unattended

D:\SQL\Servers\setup.exe /qb /settings D:\TFS\SQL2005ForATDT.ini

pause

:: # Stop SQLBrowser service before SP2 install

sc stop SQLBrowser

sc config SQLBrowser start= auto

:: # Run SQL2005 SP2 unattended

D:\SQLSP2\SQLServer2005SP2-KB921896-x86-ENU.exe /quiet /allinstances

:: # Change SQLBrowser service to automatic statup and start

sc start SQLBrowser

pause

:: ############ WSS 2.0 SP2

D:\WSS\stsv2_ENU.exe /C:”setupsts.exe /remoteSql=yes /provision=no /q”

cscript C:\Inetpub\AdminScripts\adsutil.vbs set w3svc/1/NTAuthenticationProviders “NTLM”

pause

:: ############ .NET Hotfix

D:\TFS\KB913393\NDP20-KB913393-X86.exe /q

pause

:: ############ TFS Single-Server install

start /wait D:\TFS\atdt\setup.exe

pause

:: ############ TFS Team Explorer

start /wait D:\TFS\tfc\setup.exe

pause

:: ############ TFS SP1

:: # TFS Quiescene patch

D:\TFS_SP1\VS80-KB919156-v2-X86.exe /q

pause

:: # TFS SP1

D:\TFS_SP1\TFS_SP1_VS80sp1-KB926738-X86-ENU.exe /q

pause

:: # TeamSuite SP1 - disable patch cache to speed it up

reg export HKLM\Software\Policies\Microsoft\Windows\Installer %temp%\installer.reg

reg add HKLM\Software\Policies\Microsoft\Windows\Installer /v MaxPatchCacheSize /t REG_DWORD /d 0 /f

net stop msiserver

start /wait D:\TFS_SP1\TeamSuiteSP1_VS80sp1-KB926601-X86-ENU.exe /q

reg delete HKLM\Software\Policies\Microsoft\Windows\Installer /v MaxPatchCacheSize /f

reg import %temp%\installer.reg

net stop msiserver

del /q %temp%\installer.reg 2>nul

pause

:: ############ Team Plain

D:\WEB\TeamPlain-Web-2.0-RC.msi /q

Summary

In this post we have learnt how to automate the setup of users and perform unattended installations of most of the TFS components.

3 Comments

  1. Posted August 28, 2007 at 11:23 pm | Permalink

    Update: Turns out that "/expires:never" on the "NET USER" is not what I expected. It sets the account expiry, not the password expiry.You will need to either manually set the "Password never expires" option, or use this script:http://www.markwilson.co.uk/blog/2004/09/script-to-disable-password-expiry-for.htmI’ll update my scripts when I have a moment.

  2. Muhammad Imran
    Posted December 15, 2007 at 12:25 am | Permalink

    really great article for beginners about TFS installation, it helped me alot.

  3. Aleem Jan
    Posted May 26, 2008 at 6:45 pm | Permalink

    Really Great for begginers,but i would suggest to put some thing for advance learners.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*