Script for periodical get latest

Published on
11,580 Points
Last Modified:
Mohamed Osama
System Admin , Network Admin , Systems and Network Security Enthusiast, Software Configuration manager, Problem solver.
When working in a large software development team, whether you have many developers working on the same projects, or your project is linked to other projects; it is very important that developers regularly perform "get latest" to ensure that the changes applied by their team mates are included in their workspace.

Although Team Foundation Server 2008 & Visual studio 2008 offer a feature to get latest on checkout, sometimes in larger development teams, there is a need to always ensure the workspaces are most updated all the time.

The below solution helped achieve this within our team, since you can not always rely on the developers' memory / discipline to perform get latest manually.

-Create a new text document with the below text

@echo off
CD D:\Development_applications
"%PROGRAMFILES%\Microsoft Visual Studio 9.0\Common7\IDE\TF.exe" get

Where D:\development applications is your workspace folder , change it to your actual workspace.

Save the file as GET.bat in the root of your C drive or wherever you wish.
Open Command Prompt (CMD).
Type the below command.

Schtasks /Create /SC Onidle /I 5 /TN GET /TR C:\get.bat

Enter your Domain account password when prompted into CMD window.

This will create a scheduled task that runs when the computer is idle for 5 minutes (not in use). This will enforce get latest from Team foundation server source control and ensure your workspace is always updated.

You can also edit the scheduled task directly from Control Panel > Scheduled tasks later on to schedule it on different times that suit your schedule (at night , on login / log off ,etc..).

Another thing to consider is to regularly update the password in the scheduled task whenever your domain password changes. This is necessary to avoid running this scheduled task with a wrong Password, which may cause your Domain account to get locked out.

Hope this helps you as much as it helped me .
Ask questions about what you read
If you have a question about something within an article, you can receive help directly from the article author. Experts Exchange article authors are available to answer questions and further the discussion.
Get 7 days free