By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,165 Members | 1,928 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,165 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.