Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / April 2006

Tip: Looking for answers? Try searching our database.

Perl Script When Launched From the Service Fails to Load Environment Variables

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ANarula - 21 Apr 2006 08:19 GMT
I am running into a strange problem. I have perl script which reads the
"APPDATA" environment variable, and does some work on that directory.

When I a launch this script from Command Prompt, it works perfectly fine,
however when the same script is launched from a DLL hosted in a particular
Service, the script fails to read the envrionment variable.

Does any one has any clue, whats going wrong ?

Regards,
Abhishek
Stephen Kellett - 21 Apr 2006 10:51 GMT
In message <EtzygPRZGHA.4884@TK2MSFTNGP02.phx.gbl>, Anarula <a@a.com>
writes
>I am running into a strange problem. I have perl script which reads the
>"APPDATA" environment variable, and does some work on that directory.
[quoted text clipped - 4 lines]
>
>Does any one has any clue, whats going wrong ?

The script is most likely loading environment variables, but the
environment variables will be for the account it is running on. Most
likely the service is not running in the same user account as the
account you expect. Try running the service on your user account and see
what happens, or try adding the environment variables to the local or
system account (guess) that your service is running as.

Same comment applies to the registry (I got bitten with this with the
registry - makes sense to me that the environment variables will be the
same).

Stephen
Signature

Stephen Kellett
Object Media Limited    http://www.objmedia.demon.co.uk/software.html
Computer Consultancy, Software Development
Windows C++, Java, Assembler, Performance Analysis, Troubleshooting

Bruno van Dooren - 21 Apr 2006 12:46 GMT
>I am running into a strange problem. I have perl script which reads the
>"APPDATA" environment variable, and does some work on that directory.
[quoted text clipped - 4 lines]
>
> Does any one has any clue, whats going wrong ?

The most probably cause is that the service is running with LOCAL_SYSTEM or
LOCAL_SERVICE account credentials for which that variable is not defined.

To test this you can go to control panel ->administrative services ->
services.
open the properties window for your service, and change the logon
credentials from whatever they are to your own account credentials.

then stop and start the service. if it works then, it means that the
variable does not exist for the LOCAL_SYSTEM or SERVICE account.

Signature

Kind regards,
   Bruno van Dooren
   bruno_nos_pam_van_dooren@hotmail.com
   Remove only "_nos_pam"


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.