PVCS from vbscript via TeamCity Command line runner fails

Posted on 2009-02-23
Last Modified: 2013-11-25

We use TeamCity as our CI server, and are very happy with it.  I'm trying to integrate a home-grown tracking system that we use for, among other things, specifying SQL dependencies and apply order for builds.  The tracking system stores everything in MSSQL 2k, while version control is in PVCS.  Moving away from PVCS for these files is not an option at the moment.

I have written a vbscript that does a few things, etc etc, gets a list of files, and processes them.  It runs fine from the command line.  When run from the TeamCity Command Line Runner, it fails.  

I use two PVCS command line tools, vcs.exe to apply a promotion group, and pcli.exe to get the file, and apply a version label.  vcs.exe returns error code 1, pcli returns error code 3.  

Teamcity service and agent both run as 'teamcity', a domain user account.
v:\pvcs is mapped to the repository. teamcity user has been given full control
d:\build is a temp directory. teamcity user has been given full control

The PVCS client runs and works fine - sees the repository no problem.
PVCS command line tools are in the path and can be run no problem.  Looking at the agent environment in TeamCity, the path lists them there as well.

The code box lists some log output from team city.  When something fails, I output the cmdline that was trying to run.  I can copy and paste that and it will run successfully.
[11:23:29]: [AdminMiscellaneous.html] runCmd

[11:23:29]: [AdminMiscellaneous.html] Failure: Couldn't apply TEST promotion group. Code: 1; Command: vcs -cV:\PVCS\archives\ctpkppx1.cfg -#3 -Y -gTEST:1.6 v:\pvcs\archives\com\docs\html\AdminMiscellaneous.html

[11:23:31]: [AdminMiscellaneous.html] runCmd

[11:23:31]: [runCmd] 11:23:31 Feb.23.09 [Error]

[11:23:31]: [runCmd] The project root could not be loaded: "v:\PVCS".

[11:23:31]: [AdminMiscellaneous.html] Failure: Couldn't get AdminMiscellaneous.html. Code: -3; Command: pcli run -y get -prv:\PVCS -nm -ad:\build\pvcs -o -bp/ -r1.6 /com/docs/html/AdminMiscellaneous.html

Open in new window

Question by:Hecatonchires
    LVL 24

    Accepted Solution

    You say that TeamCity runs as a service, and also that you are using mapped drives?  If the Command Line Runner is running in the context of the service, mapped drives are not available, so this will fail.

    More info at:

    Is this likely to be the problem?  If so, you could try changing all the paths to UNC - this should resolve it.
    LVL 7

    Author Comment

    That... does not make me happy.  PVCS is required to run with a drive letter, under this configuration anyway and with this version anyway.  I'll do some poking on PVCS and see if I can access it using a UNC.  Leaving this open a little longer, but at the moment you're getting the points purple.  
    LVL 24

    Expert Comment

    After digging a little more, it seems that it is possible to map a drive in a service.  I have found many mentions of it but so far unfortunately the links to the code or working examples (outside VB or VB.Net) have disappeared.

    One thing that does need to be done is for the service itself to map the drive.  A service runs in it's own session (even if it shares the user account), so any mapped drives are not available when the service starts.  However, it seems that it is possible to map the drive once the service is started...  But I just can't find any articles that show how this could be done from VBScript (apparently net use, etc. does not work).

    That said, due to the KB article and MS's advice (there are loads of references saying services should use UNC not mapped drives), the best solution would be to find some way to get it to use UNC.
    LVL 7

    Author Closing Comment

    It's definitely the problem.  Already have 1 command working, the other looks like it will require some more fiddling.  Thanks for the help PP

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    In our personal lives, we have well-designed consumer apps to delight us and make even the most complex transactions simple. Many enterprise applications, however, are a bit behind the times. For an enterprise app to be successful in today's tech wo…
    Skype is a P2P (Peer to Peer) instant messaging and VOIP (Voice over IP) service – as well as a whole lot more.
    Viewers will learn how to use the Hootsuite Dashboard.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now