Thanks for the contribution Troy but the service is running as
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.
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]>
wrote:
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,
--
Troy
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.
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,
--
Troy