473,473 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How get "log on locally" users and groups programatically?

Thought I'd try some other newsgroups for a response...

Thanks
Jonathan
Hi,

Spent nearly 8 hours googling and trying code on this yesterday without much success. I'd like to write a .NET application (using .NET primitives, older Win32 calls, or WMI etc) to work out which users can log onto a machine the application is running on. The platforms I'd like to support are
NT/2000/XP - although 98 would be good too.

It looks like for 2000 and XP OS' the answer is listed in the "Local
Security Policy" control panel application under the "Local Policies/User
Rights Assignment/Log on locally" policy. However, after trying a lot of
"GetObject("winmgmts:\\.\root") (or \RSOP\Computer or \root\SECURITY)" type calls I'm no further in actually getting at the list the Local Security
Policy displays - I'm not even sure which namespace I should be
looking in (as rsop doesn't exist on 2000 or below).

Can someone point me towards a solution for getting this list of users that can log on? I'd like a solution which doesn't rely on domains (like a
standalone PC), although clearly if a machine is in a domain I need to
handle it. Also, is this policy really the definitive answer I should be
looking at or is there an alternative (esp. for older OS')?

Thanks
Jonathan

Nov 15 '05 #1
1 1683
Try connecting to root\cimv2.

--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Jonathan Trevor" <tr****@fxpal.com> wrote in message
news:eT**************@tk2msftngp13.phx.gbl...
Thought I'd try some other newsgroups for a response...

Thanks
Jonathan
Hi,

Spent nearly 8 hours googling and trying code on this yesterday without

much
success. I'd like to write a .NET application (using .NET primitives,

older
Win32 calls, or WMI etc) to work out which users can log onto a machine

the
application is running on. The platforms I'd like to support are
NT/2000/XP - although 98 would be good too.

It looks like for 2000 and XP OS' the answer is listed in the "Local
Security Policy" control panel application under the "Local Policies/User Rights Assignment/Log on locally" policy. However, after trying a lot of
"GetObject("winmgmts:\\.\root") (or \RSOP\Computer or \root\SECURITY)"

type
calls I'm no further in actually getting at the list the Local Security
Policy displays - I'm not even sure which namespace I should be
looking in (as rsop doesn't exist on 2000 or below).

Can someone point me towards a solution for getting this list of users

that
can log on? I'd like a solution which doesn't rely on domains (like a
standalone PC), although clearly if a machine is in a domain I need to
handle it. Also, is this policy really the definitive answer I should be
looking at or is there an alternative (esp. for older OS')?

Thanks
Jonathan


Nov 15 '05 #2

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

Similar topics

1
by: jerrygarciuh | last post by:
Hello, I am finding that on a new server where I am developing $_SERVER and $_SERVER Do not show up in $_SERVER when I when they should be defined I test using print_r($_SERVER) or this
0
by: Jonathan Trevor | last post by:
Hi, Spent nearly 8 hours googling and trying code on this yesterday without much success. I'd like to write a .NET application (using .NET primitives, older Win32 calls, or WMI etc) to work out...
0
by: Klemens | last post by:
what do entry's like this in db2diag.log indicate? ------------------------------------------- 2004-01-14-09.07.52.650000 Instance:WWS Node:000 PID:3512(db2syscs.exe) TID:1116 ...
6
by: Fan Ruo Xin | last post by:
Last monday, I tried to create a working table, and failed because of 'Log Full'. There were two applications running at that time - one is autoload (during the split phase), another one is "insert...
3
by: Phil Sherman | last post by:
What is the relationship between the snapshot elements: Log pages written Number write log IOs Number partial page log IOs There doesn't appear to be any information in my PDF System monitor...
9
by: Mike Von Stein | last post by:
Maybe I'm missing something obvious, but if I several MDB's that use the same secure workgroup MDW file and the user logs into one of them is there a way through code that I can open other...
5
by: GaryDean | last post by:
Using 1.1.... I have an application using Forms Authentication that, like all other such applicaitons, uses FormsAuthentication.RedirectFromLoginPage to authenticate a user. at a point in time...
0
by: william | last post by:
Hi All, I'm using Microsoft logging library to log errors in my vb.net applications(web service). I put "Microsoft.Practices.EnterpriseLibrary.Logging.dll" into web.config file for codebase,...
0
by: yousefomar | last post by:
Hi Pros, I have a weird problem here. I am logging from my .NET app to a custom log, but unfortunately, the events are redirected to the Application log. I am sure that I am specifying the log...
2
by: TC | last post by:
I installed an ASP.NET application on my web server, but it doesn't work. When I browse to a page, I get an error message. The message doesn't say much, but it does tell me: An error message...
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
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
1
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.