473,385 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

GetEnvironmentVariable in Windows Service

I've written code in VB.Net that calls GetEnvironmentVariable. When I
execuate the code as part of a Windows Form, it reads the environment
variable with no problem.

I put the code in a Windows Service, however, and it can't seem to read
the same environment variable.

I used Microsoft .Net Framework to give the application every possible
permission, but it doesn't seem to help.

Ideas?

Mar 14 '06 #1
2 1789
<fd*****@yahoo.com> schrieb
I've written code in VB.Net that calls GetEnvironmentVariable. When
I execuate the code as part of a Windows Form, it reads the
environment variable with no problem.

I put the code in a Windows Service, however, and it can't seem to
read the same environment variable.

I used Microsoft .Net Framework to give the application every
possible permission, but it doesn't seem to help.

Ideas?

Is it a user specific environment variable, or a system variable?

Control panel -> System: Folder "extended" -> Button "Environment variables"

The service is usually running under a different account.
Armin

Mar 14 '06 #2
It is a system variable. It was originally a user variable, so I
switched to system variable, but with no better results.

Mar 14 '06 #3

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

Similar topics

0
by: Mike Burton | last post by:
Hi folks, We've got a VB6 app that needs to shell out to a .NET executable. The main VB6 app calls a plugin dll (also VB6) which simply uses Shell (or CreateProcessA, we've tried both) to start...
9
by: SP | last post by:
Hi All, I wrote a windows service which is supposed to stop after specified amount of time. I am calling OnStop() after specified time. OnStop() methods executed but I dont see the service...
0
by: François Lemaire | last post by:
I had an ASPNET application keeping files into the LocalApplicationData folder of the ASPNET account in IIS 5.0 which worked perfectly, but it doesn't workon IIS 6.0 (windows server 2003). I rely...
1
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. I'm having trouble getting the code that I've written to work, can anyone shed some light as to where I'm...
0
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. The program I'm trying to develop needs to be able to do the following: - Select remote server -...
6
by: Nikolay Petrov | last post by:
the GetEnvironmentVariable method returns "Nothing" when used against a environment variable, created by me. I've tried using SET from the console, or "Environment Variables" in my computer...
2
by: deko | last post by:
When to use a privileged user thread rather than a windows service? That's the question raised in a previous post . It was suggested that if the service needs to interact with a WinForms app...
2
by: fdmaxey | last post by:
I've written code in VB.Net that calls GetEnvironmentVariable. When I execuate the code as part of a Windows Form, it reads the environment variable with no problem. I put the code in a Windows...
4
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to...
5
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name?...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.