473,750 Members | 2,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
Apr 21 '06 #1
2 1737
In message <Et************ **@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.

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 ?


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
--
Stephen Kellett
Object Media Limited http://www.objmedia.demon.co.uk/software.html
Computer Consultancy, Software Development
Windows C++, Java, Assembler, Performance Analysis, Troubleshooting
Apr 21 '06 #2
>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 ?


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 ->administrati ve 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.

--

Kind regards,
Bruno van Dooren
br************* *********@hotma il.com
Remove only "_nos_pam"
Apr 21 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5082
by: Sandman | last post by:
The subject says it all. I am doing a: I have a perl script in which I am using a ReadParse routine that parses the $ENV{'QUERY_STRING'} or $ENV{'CONTENT_LENGTH'} which are two variables passed to the script under usual SSI (.shtml) containing form data submitted to the page from which the script is executed from. Well, since switching to PHP, I have moved most of my perl scripts to php equivalents, but there are a few perl scripts...
4
2414
by: Keith | last post by:
All: What is the difference between Perl (CGI) and PHP (Apache module)? I thought both used servers to direct the user to the appropiate Perl or PHP program in order to execute the program to interpret the user's Perl or PHP script respectively. Keith
0
2393
by: Envex Developments | last post by:
Hey guys, I have a need to install the DBD::Pg Perl module on many shared web servers, which do not have PostgreSQL installed. Then the DBD::Pg module will just connect to a remote PostgreSQL database, hosted elsewhere. I'm having some problems doing this. First off, I modified the Makefile.PL, and added the three following links just above the check for environment variables:
0
2314
by: Envex Developments | last post by:
Hey guys, I have a need to install the DBD::Pg Perl module on many shared web servers, which do not have PostgreSQL installed. Then the DBD::Pg module will just connect to a remote PostgreSQL database, hosted elsewhere. I'm having some problems doing this. First off, I modified the Makefile.PL, and added the three following links just above the check for environment variables:
9
2457
by: Bjorn Abelli | last post by:
Hi all, When I run a normal application I can get who started a process with the following example: Process myProcesses = Process.GetProcesses(); foreach(Process p in myProcesses) { string user = p.StartInfo.EnvironmentVariables;
4
2287
by: pablocruise77 | last post by:
We have two Perl script that use the open command to read an encrypted file. We just changed from gzip to gpg. One script works fine. The other is called from the web and fails on the open. Both run on UNIX hosts running SunOS 5.9 and Perl 5.8.8. To debug, I scaled down the problem script to something called testread4.pl. When I run it from the UNIX command prompt, it works fine. It opens the encrypted file and returns 10 line of...
0
1392
by: Rebles | last post by:
I'm writing a PERL script to access and insert rows into a Microsoft SQL. i'm using MS SQL Server Management Studio Express (2005) to architect tables and queries. I've inserted two records into my "Pools" table One from MS SQL Manager as a test, and another from my PERL script. The one inserted by MS SQL Manager shows up everytime. The row from my PERL script doesn't show up on MS SQL Manager and ONLY shows up on my PERL script and...
1
2279
by: Rebles | last post by:
Hi, I just posted this in the MS SQL Section, but maybe my problem is rooted in Perl, so it's more appropriate to post here instead (sorry for the double post) I'm writing a PERL script to access and insert rows into a Microsoft SQL. i'm using MS SQL Server Management Studio Express (2005) to architect tables and queries. I've inserted two records into my "Pools" table One from MS SQL Manager as a test, and another from my PERL script....
1
2553
by: replysonika | last post by:
Hello, I run a Java app with subprocess from Python script. This python script is called from another Python Wrapper. python = subprocess.Popen(, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
0
9001
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9583
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9342
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6808
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6081
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4716
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4888
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3323
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2226
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.