General XP Access Question

  • Thread starter Alastair MacFarlane
  • Start date
A

Alastair MacFarlane

Dear All,

I have been asked to create an application that reads some data from the
registry and also from ini files stored in the application data folder. The
program the user runs would need to look in all the profiles on that pc,
search for ini files in the profiles and store it in a central database.
Ideally I would like to create the program, save it on a central server and
send an e-mail out for all the relevant staff to run the program. The user
wouldn't have any special rights on the windows XP pc environment.

The mechanics of the process are straightforward. I just wondered if it is
possible? I have also posted this on the WindowsXP General forum and VB
General as well as I am unsure which forum to post it on.

Thanks again.

Alastair MacFarlane
 
P

Pegasus \(MVP\)

Alastair MacFarlane said:
Dear All,

I have been asked to create an application that reads some data from the
registry and also from ini files stored in the application data folder.
The program the user runs would need to look in all the profiles on that
pc, search for ini files in the profiles and store it in a central
database. Ideally I would like to create the program, save it on a central
server and send an e-mail out for all the relevant staff to run the
program. The user wouldn't have any special rights on the windows XP pc
environment.

The mechanics of the process are straightforward. I just wondered if it is
possible? I have also posted this on the WindowsXP General forum and VB
General as well as I am unsure which forum to post it on.

Thanks again.

Alastair MacFarlane

Ini files are only rarely used these days so you probably have to
concentrate of the registry.

VB Scripts can read any registry location and write the data to a central
database. If you run your script during the startup phase when nobody is
logged on, using an administrator's, account then it is possible to access
all of the user registry hives kept on that machine.
 
M

MikeD

Alastair MacFarlane said:
Dear All,

I have been asked to create an application that reads some data from the
registry and also from ini files stored in the application data folder.
The program the user runs would need to look in all the profiles on that
pc, search for ini files in the profiles and store it in a central
database. Ideally I would like to create the program, save it on a central
server and send an e-mail out for all the relevant staff to run the
program. The user wouldn't have any special rights on the windows XP pc
environment.

The mechanics of the process are straightforward. I just wondered if it is
possible? I have also posted this on the WindowsXP General forum and VB
General as well as I am unsure which forum to post it on.

Only question I saw there was "is it possible?". Sure. Practically
anything is possible. It's just a matter of difficulty in doing it. For the
Registry, enumerate through HKEY_USERS. That's probably the easier of the 2.
For INI files, search for them under Documents and Settings (for XP or
under, Vista's a different story).

For a better answer, you need to be more specific about what exactly you're
having difficulty with.
 
A

Alastair MacFarlane

Thanks MikeD and Pegasus,

I have been asked to read a value from the Registry which is not a problem.
The main issue I think is with reading the value from an ini file in all the
profiles on that PC, for example, there could be three profiles on this pc
and on two of the profiles there is a file in the application data folder
called pn.ini that I want to read a value from. I want to be able to loop
through the profiles, find the ini file, read a value and write it to a
database. From what I think Pegasus is saying, I would have to execute the
code before the user logs on. The software would run with an administrator's
account. Is there anyway the code can be executed by the general user
without admin rights to the local machine to achieve the same result? Are
the profiles only accessible by users of the admin group or if the software
is running under an admin account? At the time of writing if I have to do it
before logging on, I will need to get a list of all the relavant pcs and
also I will need the help of my IT department. I am trying to avoid this.

If this is the only way then this is the way it will need to be.

Thanks again for both your replies.

Alastair
 
B

Bill McCarthy

Hi Alastair,

To read from the other profiles the user will need to be logged in with
administrator rights.
 
E

expvb

Alastair MacFarlane said:
Dear All,

I have been asked to create an application that reads some data from the
registry and also from ini files stored in the application data folder.
The program the user runs would need to look in all the profiles on that
pc, search for ini files in the profiles and store it in a central
database. Ideally I would like to create the program, save it on a central
server and send an e-mail out for all the relevant staff to run the
program. The user wouldn't have any special rights on the windows XP pc
environment.

The mechanics of the process are straightforward. I just wondered if it is
possible? I have also posted this on the WindowsXP General forum and VB
General as well as I am unsure which forum to post it on.

Thanks again.

If your objective is to make the per user configuration the same for the
logged on user regardless of which workstation they use, check Roaming user
profiles here:

http://en.wikipedia.org/wiki/Roaming_user_profile

If you want to do something in your own, see this VB6 sample which enumerate
the users in the local computer:

http://vbnet.mvps.org/code/network/netuserenum.htm

Also check NetUserEnum(USER_INFO_3 or USER_INFO_4), and the resultant
usriX_home_dir and usriX_profile variables.

For the registry, see LoadUserProfile(), or enumerate HKEY_USERS. To get the
user's SID, use LookupAccountName. See this sample for how to use that
function:

http://vbnet.mvps.org/code/network/lookupaccountname.htm
 
P

Pegasus \(MVP\)

See below.

Alastair MacFarlane said:
Thanks MikeD and Pegasus,

I have been asked to read a value from the Registry which is not a
problem. The main issue I think is with reading the value from an ini file
in all the profiles on that PC, for example, there could be three profiles
on this pc and on two of the profiles there is a file in the application
data folder called pn.ini that I want to read a value from. I want to be
able to loop through the profiles, find the ini file, read a value and
write it to a database. From what I think Pegasus is saying, I would have
to execute the code before the user logs on.
*** Only if you need to access user registry hives. Ini files are
*** not normally locked and can be accessed at any time.
The software would run with an administrator's account. Is there anyway
the code can be executed by the general user without admin rights to the
local machine to achieve the same result?
*** This is a permissions issue. If the ini files reside in the various
*** user profile folders then Bill McCarthy's comment applies.
Are he profiles only accessible by users of the admin group or if the
software is running under an admin account? At the time of writing if I
have to do it before logging on, I will need to get a list of all the
relavant pcs and also I will need the help of my IT department. I am
trying to avoid this.
*** You will need their help in order to access other people's
*** profile folders.
If this is the only way then this is the way it will need to be.

Thanks again for both your replies.

Alastair
 
A

Alastair MacFarlane

Pegasus and others,

Thanks for the clarification on this. Also thanks expvb for the interesting
urls.

Alastair

Pegasus (MVP) said:
See below.

Alastair MacFarlane said:
Thanks MikeD and Pegasus,

I have been asked to read a value from the Registry which is not a
problem. The main issue I think is with reading the value from an ini
file in all the profiles on that PC, for example, there could be three
profiles on this pc and on two of the profiles there is a file in the
application data folder called pn.ini that I want to read a value from. I
want to be able to loop through the profiles, find the ini file, read a
value and write it to a database. From what I think Pegasus is saying, I
would have to execute the code before the user logs on.
*** Only if you need to access user registry hives. Ini files are
*** not normally locked and can be accessed at any time.
The software would run with an administrator's account. Is there anyway
the code can be executed by the general user without admin rights to the
local machine to achieve the same result?
*** This is a permissions issue. If the ini files reside in the various
*** user profile folders then Bill McCarthy's comment applies.
Are he profiles only accessible by users of the admin group or if the
software is running under an admin account? At the time of writing if I
have to do it before logging on, I will need to get a list of all the
relavant pcs and also I will need the help of my IT department. I am
trying to avoid this.
*** You will need their help in order to access other people's
*** profile folders.
 
K

Karl E. Peterson

Pegasus said:
Ini files are only rarely used these days so you probably have to
concentrate of the registry.

Huh? WTH kind of answer is that? That's his task.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top