Rainey, Mark (Cleveland) wrote:
Thanks for the contribution Troy but the service is running asyou could try copying the sample <script> from {nant-install}\examples\ScriptTask\script-sample.build into your build file. It enumerates and prints all currently set properties.
mydomain/myself so that is can access environment variables and the network.
I still wonder why I can use environment::get-variable('PATH'). That returns
the path but when I echo the ${sys.env.PATH} variable it says nothing is
set.
There have been issues reported in the past where the PATH variable was actually defined on the system as 'path' ie lowercase so that when sysinfo added it to the property list it added it lower case ie ${sys.env.path} . Env vars aren't case sensitive but properties are.
Ian
Mark
_____
From: Troy Laurin [mailto:[EMAIL PROTECTED] Sent: Monday, April 18, 2005 10:11 PM
To: Rainey, Mark (Cleveland)
Cc: nant-users@lists.sourceforge.net
Subject: Re: [Nant-users] PATH not set when running nant from a Service
On 4/19/05, Rainey, Mark (Cleveland) <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:
So I am guessing the PATH environment variable isn't being set. I run
sysinfo and then check the variable with environment::get-variable('PATH').
That returns the path but when I echo the ${sys.env.PATH} variable it says nothing is set. Has anyone run into PATH problems before or know what is
going on? Thanks, Mark
By default, Windows services are run under the SYSTEM account. This is an internal account that is local to all windows boxes (NT-derived, anyway).
What this means is that your _user_ environment is not accessible to the service. All _system_ environment variables are available as normal. To the best of my knowledge, the SYSTEM account does not have a user environment.
Basically, you have two options: Set your path as a system environment variable. This is often the best approach, since the programs that are installed don't change depending on which user is logged in. The second option is to change the user that the service runs as. In the Services control panel applet, you can set the credentials for the service (in the Log On tab in Windows XP). If the service logs in as you, then it has access to all of your user environment settings.
Which option is best depends on what your script is required to do. If you access a source code repository that is based on your Windows user account (eg: ClearCase), then you will definitely need to change the login account for the service. If you need to access files on the network or you need to write files that have specific ACLs, then this is probably also easiest to accomplish by logging in as a specific user (the SYSTEM account has no permissions outside the local machine... or perhaps it is covered by the EVERYONE group, I can't remember off the top of my head)
Hope this helps,
------------------------------------------------------- This SF.Net email is sponsored by: New Crystal Reports XI. Version 11 adds new functionality designed to reduce time involved in creating, integrating, and deploying reporting solutions. Free runtime info, new features, or free trial, at: http://www.businessobjects.com/devxi/728 _______________________________________________ Nant-users mailing list Nant-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-users